Initial commit for create user role
Change-Id: I8b4f03df4936e4ba6a1abf099fa099ad85cfc073
This commit is contained in:
parent
8caab36eab
commit
5cc2c776df
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.tox
|
40
.zuul.yaml
Normal file
40
.zuul.yaml
Normal file
@ -0,0 +1,40 @@
|
||||
---
|
||||
# Copyright 2020 VEXXHOST, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- job:
|
||||
name: ansible-role-base-server-functional
|
||||
run: examples/playbook.yml
|
||||
|
||||
- job:
|
||||
name: ansible-role-base-server-functional-centos-7
|
||||
parent: ansible-role-base-server-functional
|
||||
nodeset: centos-7
|
||||
|
||||
- job:
|
||||
name: ansible-role-base-server-functional-debian-buster
|
||||
parent: ansible-role-base-server-functional
|
||||
nodeset: debian-buster
|
||||
|
||||
- project:
|
||||
check:
|
||||
jobs:
|
||||
- ansible-role-base-server-functional-centos-7
|
||||
- ansible-role-base-server-functional-debian-buster
|
||||
- tox-linters
|
||||
gate:
|
||||
jobs:
|
||||
- ansible-role-base-server-functional-centos-7
|
||||
- ansible-role-base-server-functional-debian-buster
|
||||
- tox-linters
|
1
README.rst
Normal file
1
README.rst
Normal file
@ -0,0 +1 @@
|
||||
Ansible Role Base Server
|
17
defaults/main.yml
Normal file
17
defaults/main.yml
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
# Copyright 2020 VEXXHOST, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
base_server_groups: []
|
||||
base_server_users: []
|
27
examples/playbook.yml
Normal file
27
examples/playbook.yml
Normal file
@ -0,0 +1,27 @@
|
||||
---
|
||||
# Copyright 2020 VEXXHOST, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
- name: Run base-server
|
||||
hosts: all
|
||||
roles:
|
||||
- base-server
|
||||
vars:
|
||||
base_server_users:
|
||||
- name: "vblando"
|
||||
groups: ['sysadmin']
|
||||
shell: "/bin/bash"
|
||||
state: "present"
|
||||
public_key: "https://github.com/vblando.keys"
|
||||
base_server_groups:
|
||||
- sysadmin
|
38
tasks/main.yml
Normal file
38
tasks/main.yml
Normal file
@ -0,0 +1,38 @@
|
||||
---
|
||||
# Copyright 2020 VEXXHOST, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Create groups
|
||||
group:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
become: true
|
||||
loop: "{{ base_server_groups }}"
|
||||
|
||||
- name: Create users
|
||||
user:
|
||||
name: "{{ item.name }}"
|
||||
groups: "{{ item.groups }}"
|
||||
shell: "{{ item.shell | default('/bin/bash') }}"
|
||||
state: "{{ item.state | default(omit) }}"
|
||||
become: true
|
||||
with_items: "{{ base_server_users }}"
|
||||
|
||||
- name: Setup authorized keys
|
||||
authorized_key:
|
||||
user: "{{ item.name }}"
|
||||
key: "{{ item.public_key }}"
|
||||
state: "{{ item.state | default(omit) }}"
|
||||
become: true
|
||||
with_items: "{{ base_server_users }}"
|
2
test-requirements.txt
Normal file
2
test-requirements.txt
Normal file
@ -0,0 +1,2 @@
|
||||
ansible-lint
|
||||
yamllint
|
Loading…
Reference in New Issue
Block a user