From 9dd4ed15832a0aa8dcb511e56fc097dfa0c1fdeb Mon Sep 17 00:00:00 2001 From: Carlos Konstanski Date: Wed, 27 Sep 2017 15:21:33 -0600 Subject: adding ansible installation to openbook docker slave --- salt/openbook/ansible/files/ansible.cfg | 15 +++++++ salt/openbook/ansible/files/ansible.yaml | 47 ++++++++++++++++++++++ .../files/install_openbook_docker_slave.yaml | 1 + 3 files changed, 63 insertions(+) create mode 100644 salt/openbook/ansible/files/ansible.cfg create mode 100644 salt/openbook/ansible/files/ansible.yaml (limited to 'salt') diff --git a/salt/openbook/ansible/files/ansible.cfg b/salt/openbook/ansible/files/ansible.cfg new file mode 100644 index 0000000..d814983 --- /dev/null +++ b/salt/openbook/ansible/files/ansible.cfg @@ -0,0 +1,15 @@ +[defaults] +host_key_checking = False +remote_user = root +log_path = /var/log/ansible/log +private_key_file = /root/.ssh/id_rsa +forks = 40 +ansible_python_interpreter = /usr/bin/python3.5 + +[ssh_connection] +pipelining = True + +[privilege_escalation] +become = True +become_user = root +become_method = sudo diff --git a/salt/openbook/ansible/files/ansible.yaml b/salt/openbook/ansible/files/ansible.yaml new file mode 100644 index 0000000..eff4a06 --- /dev/null +++ b/salt/openbook/ansible/files/ansible.yaml @@ -0,0 +1,47 @@ +--- +- name: "Install ansible" + hosts: target + tasks: + - name: "Update apt" + apt: + update_cache: yes + when: ansible_distribution == "Ubuntu" + + - name: "Install ansible package" + apt: + pkg: "{{ item }}" + state: present + with_items: + - ansible + when: ansible_distribution == "Ubuntu" + + - name: "Update yum cache" + yum: + update_cache: yes + when: ansible_distribution == "RedHat" or ansible_distribution == "CentOS" + + - name: "Install ansible package" + yum: + name: "{{ item }}" + state: present + with_items: + - ansible + when: ansible_distribution == "RedHat" or ansible_distribution == "CentOS" + + - name: "Install ansible package" + portage: + name: "{{ item }}" + state: present + with_items: + - app-admin/ansible + when: ansible_distribution == "Gentoo" + + - name: "Configure ansible" + copy: + src: "../files/{% raw %}{{ item.src }}{% endraw %}" + dest: "{% raw %}{{ item.dest }}{% endraw %}" + mode: "{% raw %}{{ item.mode }}{% endraw %}" + owner: root + group: root + with_items: + - { src: ansible.cfg, dest: /root/ansible/ansible.cfg, mode: "0644" } diff --git a/salt/openbook/ansible/files/install_openbook_docker_slave.yaml b/salt/openbook/ansible/files/install_openbook_docker_slave.yaml index 05b6c50..2f553c5 100644 --- a/salt/openbook/ansible/files/install_openbook_docker_slave.yaml +++ b/salt/openbook/ansible/files/install_openbook_docker_slave.yaml @@ -5,3 +5,4 @@ - include: openjdk.yaml - include: jenkins_user.yaml - include: ssh_keys.yaml +- include: ansible.yaml -- cgit v1.3