Fri, 23 Jun 2017 20:04:51 -0400
add bootstrap role
public_keys/ansible | file | annotate | diff | comparison | revisions | |
roles/bootstrap/defaults/main.yml | file | annotate | diff | comparison | revisions | |
roles/bootstrap/tasks/disable-stock.yml | file | annotate | diff | comparison | revisions | |
roles/bootstrap/tasks/main.yml | file | annotate | diff | comparison | revisions | |
roles/devbox/meta/main.yml | file | annotate | diff | comparison | revisions | |
roles/user/defaults/main.yml | file | annotate | diff | comparison | revisions | |
roles/user/tasks/disable-stock.yml | file | annotate | diff | comparison | revisions | |
roles/user/tasks/main.yml | file | annotate | diff | comparison | revisions |
new file mode 100644 --- /dev/null +++ b/public_keys/ansible @@ -0,0 +1,1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABkACoN3BYAJHB1DYvHRWC/JNPiqXW/mQnu6pZfbBKLEwyYwYqaFk1t9AH3e4fzoiE2YQ2CCQRz8u6KSEEyTjyJvbcrxCBMSgpZxyOP/dCKvDuIz1rx5hrOVAB6NxFaJgBzNdAxnwny0iPf7DEkeNKvSoiGLTWB5kOz3eoOtwBLHTVPF3OFpiYOyAbI+3biRqPGn8wwBeeY658UktFIInee7okHt0bIyA7y6p0AKVyTjybm7BEZsUOkfZLjRH6dmJ3WX30umS/q2ToHI9aKmGsh9xi0TkrCYN0t08PnNu/f7708dCj5LjClhhvcXNiAGyO2EMdYzLVY4RMoVtB3tXVlW+TsjZvvsCl9uHnMGEk2W7WzGziXC9ftgQWr8+y3QBgoRB3TBUmpDHWbSUXVwg7f7ll8JXpA1dDYXFBdoGG7yC2/Nv9gyiSbxYjo0ypXi9wZ0fmhVI0gaYJSUmwcF+EyaYltrHFWCc77hQR+tIIEpl8z5c/7GG3QqWL2WklrmSXno6aHMbpyx6XGuhOFBNAmus= control_id@20170623
rename from roles/user/tasks/disable-stock.yml rename to roles/bootstrap/tasks/disable-stock.yml --- a/roles/user/tasks/disable-stock.yml +++ b/roles/bootstrap/tasks/disable-stock.yml @@ -1,6 +1,5 @@ --- - -- name: Disable stock users +- name: "Bootstrap: Disable stock users" shell: usermod -e 1 {{item}} ignore_errors: true with_items:
new file mode 100644 --- /dev/null +++ b/roles/bootstrap/tasks/main.yml @@ -0,0 +1,29 @@ +--- +- name: "Bootstrap: Ansible control user" + user: + name: ansible + comment: "Ansible Controller" + home: /var/lib/ansible + createhome: true + append: true + system: true + state: present + +- name: "Bootstrap : ansible pubkeys" + authorized_key: + manage_dir: true + user: ansible + key: "{{item}}" + with_file: + - 'public_keys/ansible' + +- name: "Bootstrap : ansible sudo" + lineinfile: + dest: /etc/sudoers + state: present + regexp: '^ansible' + line: 'ansible ALL=(ALL) NOPASSWD: ALL' + validate: 'visudo -cf "%s"' + +- include: disable-stock.yml + when: disable_stock_users