initial control node playbook
This commit is contained in:
commit
4a24e7cdaf
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
secrets.yml
|
3
ansible.cfg
Normal file
3
ansible.cfg
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[defaults]
|
||||||
|
inventory=./inventory
|
||||||
|
remote_user="pollen"
|
9
inventory
Normal file
9
inventory
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[aws]
|
||||||
|
aws ansible_user=ubuntu
|
||||||
|
|
||||||
|
[doc]
|
||||||
|
doc ansible_user=pollen
|
||||||
|
|
||||||
|
[servers:children]
|
||||||
|
doc
|
||||||
|
aws
|
19
playbooks/control_node.yml
Normal file
19
playbooks/control_node.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
- name: sets up the control node
|
||||||
|
hosts: localhost
|
||||||
|
vars_files:
|
||||||
|
- ../vars/secrets.yml
|
||||||
|
tasks:
|
||||||
|
- name: create the ansible control user
|
||||||
|
user:
|
||||||
|
name: ansible
|
||||||
|
generate_ssh_key: true
|
||||||
|
- name: Create the password for the control user
|
||||||
|
shell:
|
||||||
|
cmd: echo {{ become_password }} | passwd --stdin ansible
|
||||||
|
when: ansible_os_family == 'RedHat'
|
||||||
|
#when: ansible_facts['ansible_os_family'] == 'RedHat'
|
||||||
|
- name: install chpasswd on debian family os
|
||||||
|
shell:
|
||||||
|
cmd: echo ansible:{{ become_password }} | chpasswd
|
||||||
|
when: ansible_os_family == 'Debian'
|
14
playbooks/update_upgrade.yml
Normal file
14
playbooks/update_upgrade.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
- name: Updates all managed servers
|
||||||
|
hosts: all
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
group_vars: groups_vars/servers.yml
|
||||||
|
tasks:
|
||||||
|
- name: update package index on all machines
|
||||||
|
ansible.builtin.apt:
|
||||||
|
update_cache: yes
|
||||||
|
- name: Upgrade all packages to latest version
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: "*"
|
||||||
|
state: latest
|
Loading…
Reference in New Issue
Block a user