diff --git a/ansible/.github/ansible-code-bot.yml b/ansible/.github/ansible-code-bot.yml new file mode 100644 index 00000000..dd75c087 --- /dev/null +++ b/ansible/.github/ansible-code-bot.yml @@ -0,0 +1,3 @@ +--- +schedule: + interval: "daily" diff --git a/ansible/.github/workflows/tests.yml b/ansible/.github/workflows/tests.yml new file mode 100644 index 00000000..4f8f08a2 --- /dev/null +++ b/ansible/.github/workflows/tests.yml @@ -0,0 +1,17 @@ +--- +name: "CI" + +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +on: # yamllint disable-line rule:truthy + pull_request: + branches: [main] + workflow_dispatch: + schedule: + - cron: '0 0 * * *' + +jobs: + ansible-lint: + uses: ansible/ansible-content-actions/.github/workflows/ansible_lint.yaml@main diff --git a/ansible/.vscode/extensions.json b/ansible/.vscode/extensions.json new file mode 100644 index 00000000..c1b89785 --- /dev/null +++ b/ansible/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["redhat.ansible", "redhat.vscode-redhat-account"] +} diff --git a/ansible/.vscode/settings.json b/ansible/.vscode/settings.json new file mode 100644 index 00000000..d38a8713 --- /dev/null +++ b/ansible/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "ansible.python.interpreterPath": "/home/charish/rinoa-docker/ansible/.venv/bin/python" +} \ No newline at end of file diff --git a/ansible/inventory/host_vars/rinoa.yml b/ansible/inventory/host_vars/rinoa.yml new file mode 100644 index 00000000..48843968 --- /dev/null +++ b/ansible/inventory/host_vars/rinoa.yml @@ -0,0 +1,2 @@ +--- +server_name: webserver2 diff --git a/ansible/inventory/hosts.yml b/ansible/inventory/hosts.yml new file mode 100644 index 00000000..d8f9e1c4 --- /dev/null +++ b/ansible/inventory/hosts.yml @@ -0,0 +1,12 @@ +--- +all: + hosts: + benedikta: + ansible_host: 192.168.1.241 + ansible_user: charish + rikku: + ansible_host: 192.168.1.253 + ansible_user: pi + rinoa: + ansible_host: 192.168.1.254 + ansible_user: charish \ No newline at end of file diff --git a/ansible/linux_playbook.yml b/ansible/linux_playbook.yml new file mode 100644 index 00000000..05630c1d --- /dev/null +++ b/ansible/linux_playbook.yml @@ -0,0 +1,31 @@ +--- +- name: Update web servers + hosts: webservers + become: true + + tasks: + - name: Ensure apache is at the present version + ansible.builtin.dnf: + name: httpd + state: present + + - name: Write the apache config file + ansible.builtin.template: + src: /srv/httpd.j2 + dest: /etc/httpd.conf + mode: "0644" + +- name: Update db servers + hosts: databases + become: true + + tasks: + - name: Ensure postgresql is at the present version + ansible.builtin.dnf: + name: postgresql + state: present + + - name: Ensure that postgresql is started + ansible.builtin.service: + name: postgresql + state: started