mirror of
https://github.com/cwchristerw/tjas-infra
synced 2025-10-13 22:19:41 +00:00
Move Ansible to different directory
This commit is contained in:
@@ -8,8 +8,6 @@
|
|||||||
tasks:
|
tasks:
|
||||||
- name: "Installer"
|
- name: "Installer"
|
||||||
import_tasks: tasks/installer.yml
|
import_tasks: tasks/installer.yml
|
||||||
vars:
|
|
||||||
ansible_python_interpreter: "/root/.venv/ansible/bin/python3"
|
|
||||||
when:
|
when:
|
||||||
- inventory_hostname == "olympus.juva.tjas"
|
- inventory_hostname == "olympus.juva.tjas"
|
||||||
tags:
|
tags:
|
||||||
@@ -18,8 +16,6 @@
|
|||||||
|
|
||||||
- name: "Maintenance"
|
- name: "Maintenance"
|
||||||
import_tasks: tasks/maintenance.yml
|
import_tasks: tasks/maintenance.yml
|
||||||
vars:
|
|
||||||
ansible_python_interpreter: "/root/.venv/ansible/bin/python3"
|
|
||||||
when:
|
when:
|
||||||
- inventory_hostname == "olympus.juva.tjas"
|
- inventory_hostname == "olympus.juva.tjas"
|
||||||
tags:
|
tags:
|
||||||
@@ -28,8 +24,6 @@
|
|||||||
|
|
||||||
- name: "Deployer"
|
- name: "Deployer"
|
||||||
import_tasks: tasks/deployer.yml
|
import_tasks: tasks/deployer.yml
|
||||||
vars:
|
|
||||||
ansible_python_interpreter: "/root/.venv/ansible/bin/python3"
|
|
||||||
when:
|
when:
|
||||||
- inventory_hostname == "olympus.juva.tjas"
|
- inventory_hostname == "olympus.juva.tjas"
|
||||||
tags:
|
tags:
|
||||||
|
@@ -1,35 +1,35 @@
|
|||||||
---
|
---
|
||||||
- name: "Init : Python 3 : Install"
|
- name: "Installer : Python 3 : Install"
|
||||||
ansible.builtin.raw: apt install -y python3 python3-pip python3-setuptools python3-venv python3-dev
|
ansible.builtin.raw: apt install -y python3 python3-pip python3-setuptools python3-venv python3-dev
|
||||||
register: task
|
register: task
|
||||||
changed_when:
|
changed_when:
|
||||||
- "task.stdout.find('0 upgraded, 0 newly installed, 0 to remove') == -1"
|
- "task.stdout.find('0 upgraded, 0 newly installed, 0 to remove') == -1"
|
||||||
|
|
||||||
- name: "Init: Python 3 : Libraries - APT"
|
- name: "Installer: Python 3 : Libraries - APT"
|
||||||
ansible.builtin.raw: apt install -y python3-apt
|
ansible.builtin.raw: apt install -y python3-apt
|
||||||
register: task
|
register: task
|
||||||
changed_when:
|
changed_when:
|
||||||
- "task.stdout.find('0 upgraded, 0 newly installed, 0 to remove') == -1"
|
- "task.stdout.find('0 upgraded, 0 newly installed, 0 to remove') == -1"
|
||||||
|
|
||||||
- name: "Init : Python 3 : Configure - Virtual Environment : Test"
|
- name: "Installer : Python 3 : Configure - Virtual Environment : Test"
|
||||||
ansible.builtin.raw: "/root/.venv/ansible/bin/pip3"
|
ansible.builtin.raw: "/opt/ansible/bin/pip3"
|
||||||
register: task632
|
register: task632
|
||||||
changed_when: false
|
changed_when: false
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
|
||||||
- name: "Init : Python 3 : Configure - Virtual Environment : Delete"
|
- name: "Installer : Python 3 : Configure - Virtual Environment : Delete"
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "/root/.venv/ansible"
|
path: "/opt/ansible"
|
||||||
state: absent
|
state: absent
|
||||||
when:
|
when:
|
||||||
- "task632.stdout.find(\"ModuleNotFoundError: No module named 'pip'\") != -1"
|
- "task632.stdout.find(\"ModuleNotFoundError: No module named 'pip'\") != -1"
|
||||||
|
|
||||||
- name: "Init : Python 3 : Configure - Virtual Environment : Create"
|
- name: "Installer : Python 3 : Configure - Virtual Environment : Create"
|
||||||
ansible.builtin.pip:
|
ansible.builtin.pip:
|
||||||
name: pip
|
name: pip
|
||||||
state: latest
|
state: latest
|
||||||
extra_args: --upgrade
|
extra_args: --upgrade
|
||||||
virtualenv: /root/.venv/ansible
|
virtualenv: /opt/ansible
|
||||||
virtualenv_command: "python3 -m venv"
|
virtualenv_command: "python3 -m venv"
|
||||||
|
|
||||||
- name: "Installer : Tools : Install"
|
- name: "Installer : Tools : Install"
|
||||||
@@ -150,12 +150,47 @@
|
|||||||
- firewalld
|
- firewalld
|
||||||
- firewall
|
- firewall
|
||||||
|
|
||||||
|
- name: "Installer : Ansible : Dependencies - Packages (APT / Debian & Ubuntu & Linux Mint)"
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: "{{ packages }}"
|
||||||
|
state: latest
|
||||||
|
vars:
|
||||||
|
ansible_python_interpreter: /usr/bin/python3
|
||||||
|
packages:
|
||||||
|
- sshpass
|
||||||
|
- lsb-release
|
||||||
|
loop: "{{ packages }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ package }}"
|
||||||
|
loop_var: "package"
|
||||||
|
|
||||||
|
- name: "Installer : Ansible : Dependencies - Python Libraries"
|
||||||
|
ansible.builtin.pip:
|
||||||
|
name: "{{ library }}"
|
||||||
|
state: latest
|
||||||
|
extra_args: --upgrade
|
||||||
|
virtualenv: /opt/ansible
|
||||||
|
virtualenv_command: "python3 -m venv"
|
||||||
|
vars:
|
||||||
|
libraries:
|
||||||
|
- cryptography
|
||||||
|
- dnspython
|
||||||
|
- hvac
|
||||||
|
- jmespath
|
||||||
|
- netaddr
|
||||||
|
- pexpect
|
||||||
|
- xmltodict
|
||||||
|
loop: "{{ libraries }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ library }}"
|
||||||
|
loop_var: "library"
|
||||||
|
|
||||||
- name: "Installer - Ansible - Python Library"
|
- name: "Installer - Ansible - Python Library"
|
||||||
ansible.builtin.pip:
|
ansible.builtin.pip:
|
||||||
name: ansible
|
name: ansible
|
||||||
state: latest
|
state: latest
|
||||||
extra_args: --upgrade
|
extra_args: --upgrade
|
||||||
virtualenv: /root/.venv/ansible
|
virtualenv: /opt/ansible
|
||||||
virtualenv_command: "python3 -m venv"
|
virtualenv_command: "python3 -m venv"
|
||||||
tags:
|
tags:
|
||||||
- ansible
|
- ansible
|
||||||
@@ -169,7 +204,7 @@
|
|||||||
|
|
||||||
- name: "Installer : Ansible : Create Symbolic Links"
|
- name: "Installer : Ansible : Create Symbolic Links"
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
src: /root/.venv/ansible/bin/{{ binary }}
|
src: /opt/ansible/bin/{{ binary }}
|
||||||
dest: /root/bin/{{ binary }}
|
dest: /root/bin/{{ binary }}
|
||||||
state: link
|
state: link
|
||||||
vars:
|
vars:
|
||||||
@@ -192,34 +227,12 @@
|
|||||||
tags:
|
tags:
|
||||||
- ansible
|
- ansible
|
||||||
|
|
||||||
- name: "Installer - Ansible - Dependencies - Python Libraries"
|
|
||||||
ansible.builtin.pip:
|
|
||||||
name: "{{ library }}"
|
|
||||||
state: latest
|
|
||||||
extra_args: --upgrade
|
|
||||||
virtualenv: /root/.venv/ansible
|
|
||||||
virtualenv_command: "python3 -m venv"
|
|
||||||
vars:
|
|
||||||
libraries:
|
|
||||||
- cryptography
|
|
||||||
- dnspython
|
|
||||||
- hvac
|
|
||||||
- jmespath
|
|
||||||
- netaddr
|
|
||||||
- pexpect
|
|
||||||
loop: "{{ libraries }}"
|
|
||||||
loop_control:
|
|
||||||
label: "{{ library }}"
|
|
||||||
loop_var: "library"
|
|
||||||
tags:
|
|
||||||
- ansible
|
|
||||||
|
|
||||||
- name: "Installer : MariaDB : Dependencies - Python Library : pymysql"
|
- name: "Installer : MariaDB : Dependencies - Python Library : pymysql"
|
||||||
ansible.builtin.pip:
|
ansible.builtin.pip:
|
||||||
name: pymysql
|
name: pymysql
|
||||||
state: latest
|
state: latest
|
||||||
extra_args: --upgrade
|
extra_args: --upgrade
|
||||||
virtualenv: /root/.venv/ansible
|
virtualenv: /opt/ansible
|
||||||
virtualenv_command: "python3 -m venv"
|
virtualenv_command: "python3 -m venv"
|
||||||
tags:
|
tags:
|
||||||
- mariadb
|
- mariadb
|
||||||
@@ -250,7 +263,7 @@
|
|||||||
name: "Tietojärjestelmäasentajien Infra - Maintenance"
|
name: "Tietojärjestelmäasentajien Infra - Maintenance"
|
||||||
hour: "*/3"
|
hour: "*/3"
|
||||||
minute: "0"
|
minute: "0"
|
||||||
job: "/root/.venv/ansible/bin/ansible-pull -U ssh://git@github.com/cwchristerw/tjas-infra -d /root/.ansible/pull/infra --accept-host-key --private-key /root/.ssh/keys/infra --vault-password-file /root/.ansible/vault/infra tasks.yml -t maintenance"
|
job: "/opt/ansible/bin/ansible-pull -U ssh://git@github.com/cwchristerw/tjas-infra -d /root/.ansible/pull/infra --accept-host-key --private-key /root/.ssh/keys/infra --vault-password-file /root/.ansible/vault/infra tasks.yml -t maintenance"
|
||||||
tags:
|
tags:
|
||||||
- cron
|
- cron
|
||||||
|
|
||||||
@@ -258,6 +271,6 @@
|
|||||||
ansible.builtin.cron:
|
ansible.builtin.cron:
|
||||||
name: "Tietojärjestelmäasentajien Infra - Deployer"
|
name: "Tietojärjestelmäasentajien Infra - Deployer"
|
||||||
minute: "*/5"
|
minute: "*/5"
|
||||||
job: "/root/.venv/ansible/bin/ansible-pull -U ssh://git@github.com/cwchristerw/tjas-infra -d /root/.ansible/pull/infra --accept-host-key --private-key /root/.ssh/keys/infra --vault-password-file /root/.ansible/vault/infra tasks.yml -t deployer"
|
job: "/opt/ansible/bin/ansible-pull -U ssh://git@github.com/cwchristerw/tjas-infra -d /root/.ansible/pull/infra --accept-host-key --private-key /root/.ssh/keys/infra --vault-password-file /root/.ansible/vault/infra tasks.yml -t deployer"
|
||||||
tags:
|
tags:
|
||||||
- cron
|
- cron
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
name: "{{ library }}"
|
name: "{{ library }}"
|
||||||
state: latest
|
state: latest
|
||||||
extra_args: --upgrade
|
extra_args: --upgrade
|
||||||
virtualenv: /root/.venv/ansible
|
virtualenv: /opt/ansible
|
||||||
virtualenv_command: "python3 -m venv"
|
virtualenv_command: "python3 -m venv"
|
||||||
vars:
|
vars:
|
||||||
libraries:
|
libraries:
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
name: ansible
|
name: ansible
|
||||||
state: latest
|
state: latest
|
||||||
extra_args: --upgrade
|
extra_args: --upgrade
|
||||||
virtualenv: /root/.venv/ansible
|
virtualenv: /opt/ansible
|
||||||
virtualenv_command: "python3 -m venv"
|
virtualenv_command: "python3 -m venv"
|
||||||
|
|
||||||
- name: "Maintenance : MariaDB : Dependencies / Python Library : pymysql"
|
- name: "Maintenance : MariaDB : Dependencies / Python Library : pymysql"
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
name: pymysql
|
name: pymysql
|
||||||
state: latest
|
state: latest
|
||||||
extra_args: --upgrade
|
extra_args: --upgrade
|
||||||
virtualenv: /root/.venv/ansible
|
virtualenv: /opt/ansible
|
||||||
virtualenv_command: "python3 -m venv"
|
virtualenv_command: "python3 -m venv"
|
||||||
|
|
||||||
- name: "Maintenance : Podman : Prune"
|
- name: "Maintenance : Podman : Prune"
|
||||||
|
@@ -10,18 +10,109 @@
|
|||||||
- src: /root/.ansible/vault/{{ location | lower | replace('.', '') | replace(' ', '-') }}/infra
|
- src: /root/.ansible/vault/{{ location | lower | replace('.', '') | replace(' ', '-') }}/infra
|
||||||
dest: /root/.ansible/vault/infra
|
dest: /root/.ansible/vault/infra
|
||||||
|
|
||||||
|
- name: "Migrater : Python 3 : Configure - Virtual Environment : Test"
|
||||||
|
ansible.builtin.raw: "/opt/ansible/bin/pip3"
|
||||||
|
register: task632
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
|
||||||
|
- name: "Migrater : Python 3 : Configure - Virtual Environment : Delete"
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "/opt/ansible"
|
||||||
|
state: absent
|
||||||
|
when:
|
||||||
|
- "task632.stdout.find(\"ModuleNotFoundError: No module named 'pip'\") != -1"
|
||||||
|
|
||||||
|
- name: "Migrater : Python 3 : Configure - Virtual Environment : Create"
|
||||||
|
ansible.builtin.pip:
|
||||||
|
name: pip
|
||||||
|
state: latest
|
||||||
|
extra_args: --upgrade
|
||||||
|
virtualenv: /opt/ansible
|
||||||
|
virtualenv_command: "python3 -m venv"
|
||||||
|
|
||||||
|
- name: "Migrater : Ansible : Dependencies - Packages"
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: "{{ packages }}"
|
||||||
|
state: latest
|
||||||
|
vars:
|
||||||
|
ansible_python_interpreter: /usr/bin/python3
|
||||||
|
packages:
|
||||||
|
- sshpass
|
||||||
|
- lsb-release
|
||||||
|
loop: "{{ packages }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ package }}"
|
||||||
|
loop_var: "package"
|
||||||
|
|
||||||
|
- name: "Migrater : Ansible : Dependencies - Python Libraries"
|
||||||
|
ansible.builtin.pip:
|
||||||
|
name: "{{ library }}"
|
||||||
|
state: latest
|
||||||
|
extra_args: --upgrade
|
||||||
|
virtualenv: /opt/ansible
|
||||||
|
virtualenv_command: "python3 -m venv"
|
||||||
|
vars:
|
||||||
|
libraries:
|
||||||
|
- cryptography
|
||||||
|
- dnspython
|
||||||
|
- hvac
|
||||||
|
- jmespath
|
||||||
|
- netaddr
|
||||||
|
- pexpect
|
||||||
|
- xmltodict
|
||||||
|
loop: "{{ libraries }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ library }}"
|
||||||
|
loop_var: "library"
|
||||||
|
|
||||||
|
- name: "Migrater - Ansible - Python Library"
|
||||||
|
ansible.builtin.pip:
|
||||||
|
name: ansible
|
||||||
|
state: latest
|
||||||
|
extra_args: --upgrade
|
||||||
|
virtualenv: /opt/ansible
|
||||||
|
virtualenv_command: "python3 -m venv"
|
||||||
|
tags:
|
||||||
|
- ansible
|
||||||
|
|
||||||
|
- name: "Migrater : Ansible : Create Symbolic Links"
|
||||||
|
ansible.builtin.file:
|
||||||
|
src: /opt/ansible/bin/{{ binary }}
|
||||||
|
dest: /bin/{{ binary }}
|
||||||
|
state: link
|
||||||
|
vars:
|
||||||
|
binaries:
|
||||||
|
- ansible
|
||||||
|
- ansible-community
|
||||||
|
- ansible-config
|
||||||
|
- ansible-console
|
||||||
|
- ansible-doc
|
||||||
|
- ansible-galaxy
|
||||||
|
- ansible-inventory
|
||||||
|
- ansible-playbook
|
||||||
|
- ansible-pull
|
||||||
|
- ansible-test
|
||||||
|
- ansible-vault
|
||||||
|
loop: "{{ binaries }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ binary }}"
|
||||||
|
loop_var: "binary"
|
||||||
|
tags:
|
||||||
|
- ansible
|
||||||
|
|
||||||
- name: "Migrater - Schedule : Maintenance"
|
- name: "Migrater - Schedule : Maintenance"
|
||||||
ansible.builtin.cron:
|
ansible.builtin.cron:
|
||||||
name: "Tietojärjestelmäasentajien Infra - Maintenance"
|
name: "Tietojärjestelmäasentajien Infra - Maintenance"
|
||||||
hour: "*/3"
|
hour: "*/3"
|
||||||
minute: "0"
|
minute: "0"
|
||||||
job: "/root/.venv/ansible/bin/ansible-pull -U ssh://git@github.com/cwchristerw/tjas-infra -d /root/.ansible/pull/infra --accept-host-key --private-key /root/.ssh/keys/infra --vault-password-file /root/.ansible/vault/infra tasks.yml -t maintenance"
|
job: "/opt/ansible/bin/ansible-pull -U ssh://git@github.com/cwchristerw/tjas-infra -d /root/.ansible/pull/infra --accept-host-key --private-key /root/.ssh/keys/infra --vault-password-file /root/.ansible/vault/infra tasks.yml -t maintenance"
|
||||||
|
|
||||||
- name: "Migrater - Schedule : Maintenance"
|
- name: "Migrater - Schedule : Maintenance"
|
||||||
ansible.builtin.cron:
|
ansible.builtin.cron:
|
||||||
name: "Tietojärjestelmäasentajien Infra - Maintenance"
|
name: "Tietojärjestelmäasentajien Infra - Maintenance"
|
||||||
minute: "*/5"
|
minute: "*/5"
|
||||||
job: "/root/.venv/ansible/bin/ansible-pull -U ssh://git@github.com/cwchristerw/tjas-infra -d /root/.ansible/pull/infra --accept-host-key --private-key /root/.ssh/keys/infra --vault-password-file /root/.ansible/vault/infra tasks.yml -t deployer"
|
job: "/opt/ansible/bin/ansible-pull -U ssh://git@github.com/cwchristerw/tjas-infra -d /root/.ansible/pull/infra --accept-host-key --private-key /root/.ssh/keys/infra --vault-password-file /root/.ansible/vault/infra tasks.yml -t deployer"
|
||||||
|
|
||||||
- name: "Migrater - Schedule : Deployer"
|
- name: "Migrater - Schedule : Deployer"
|
||||||
ansible.builtin.cron:
|
ansible.builtin.cron:
|
||||||
|
Reference in New Issue
Block a user