added playbook to install ansible on a control server
diff --git a/configuration/update-user.yml b/configuration/update-user.yml new file mode 100644 index 0000000..98c405f --- /dev/null +++ b/configuration/update-user.yml
@@ -0,0 +1,39 @@ +--- +- hosts: '{{ hosts }}' + become: yes + + vars: + pubkey: '~/.ssh/id_rsa.pub' + + vars_files: + - ~/.apigee/credentials.yml + + tasks: + - name: Build EC2 facts cache + ec2_facts: + + - name: Build setup facts cache + setup: + + - name: Copy local public keys to server for user {{ user }} + authorized_key: + user: '{{ user }}' + state: present + key: "{{ lookup('file', '{{ pubkey }}') }}" + + - name: Permit root login over SSH + lineinfile: + state: present + dest: /etc/ssh/sshd_config + regexp: '(^#)(PermitRootLogin yes)' + line: '\2' + backrefs: yes + notify: + - Restart SSH service + when: user == 'root' + + handlers: + - name: Restart SSH service + service: + name: sshd + state: restarted
diff --git a/control-server.yml b/control-server.yml new file mode 100644 index 0000000..0120011 --- /dev/null +++ b/control-server.yml
@@ -0,0 +1,34 @@ +--- + +- include: configuration/update-user.yml + vars: + hosts: 'control' + user: 'root' + tags: + - root-user + +- hosts: control + become: yes + vars_files: + - ~/.apigee/credentials.yml + tasks: + - name: Install system packages + yum: + name: '{{ item }}' + state: present + with_items: + - python-devel + - openssl-devel + - gcc + + - name: Install pip + easy_install: + name: pip + state: latest + + - name: Install ansible + pip: + name: ansible + state: latest + register: result +