diff options
| author | Carlos Konstanski <ckonstanski@pippiandcarlos.com> | 2017-08-30 13:09:56 -0600 |
|---|---|---|
| committer | Carlos Konstanski <ckonstanski@pippiandcarlos.com> | 2017-08-30 13:09:56 -0600 |
| commit | 649f0dd9c5ca586d8b637400dd19c0c4059447d6 (patch) | |
| tree | 5ccc992a3aa5de1bcb510911dfdb21e6a54bd197 /salt/openbook/ansible/files/salt.yaml | |
initial commit
Diffstat (limited to 'salt/openbook/ansible/files/salt.yaml')
| -rw-r--r-- | salt/openbook/ansible/files/salt.yaml | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/salt/openbook/ansible/files/salt.yaml b/salt/openbook/ansible/files/salt.yaml new file mode 100644 index 0000000..d0581ae --- /dev/null +++ b/salt/openbook/ansible/files/salt.yaml @@ -0,0 +1,96 @@ +--- +- name: "Install salt" + hosts: all + tasks: + - name: "Create salt-master directories" + file: + path: "{{ item }}" + state: directory + mode: 0755 + owner: root + group: root + with_items: + - /srv + - /srv/keys + - /srv/reactor + + - name: "Create salt-master symlinks" + file: + src: "/root/openbook-installer/{{ item }}" + dest: "/srv/{{ item }}" + state: link + force: yes + with_items: + - bootstrap + - pillar + - salt + + - name: "Install salt apt key" + shell: curl -fsSL https://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest/SALTSTACK-GPG-KEY.pub | apt-key add - + when: ansible_distribution == "Ubuntu" + + - name: "Configure saltstack.list" + copy: + src: "../files/{{ item }}" + dest: "/etc/apt/sources.list.d/{{ item }}" + mode: 0644 + owner: root + group: root + with_items: + - saltstack.list + when: ansible_distribution == "Ubuntu" + + - name: "Update apt" + apt: + update_cache: yes + when: ansible_distribution == "Ubuntu" + + - name: "Install salt packages" + apt: + pkg: "{{ item }}" + state: present + with_items: + - jq + - ruby + - salt-master + - salt-minion + when: ansible_distribution == "Ubuntu" + + - name: "Install salt packages" + portage: + package: "{{ item }}" + update: yes + changed_use: yes + with_items: + - app-misc/jq + - dev-lang/ruby + - app-admin/salt + when: ansible_distribution == "Gentoo" + + - name: "Configure salt-master" + copy: + src: "../files/{{ item }}" + dest: "/etc/salt/{{ item }}" + mode: 0644 + owner: root + group: root + with_items: + - master + + - name: "Configure salt-minion" + lineinfile: + dest: "/etc/salt/minion" + regexp: "{{ item.regexp }}" + line: "{{ item.line }}" + with_items: + - { regexp: '^#master:.*$', line: "master: {{ salt_master }}" } + + - name: "Enable salt services" + service: + name: "{{ item.name }}" + enabled: yes + state: started + runlevel: "{{ item.runlevel }}" + with_items: + - { name: salt-master, runlevel: default } + - { name: salt-minion, runlevel: default } |
