gsb2024/roles/awx/tasks/main.yml
2024-01-30 12:55:46 +01:00

80 lines
2.1 KiB
YAML

---
- name: Installation de k3s ...
ansible.builtin.shell: curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.28.5+k3s1 sh -s - --write-kubeconfig-mode 644 --node-ip "{{ awx_ip }}" --flannel-iface "{{ awx_if }}"
- name: Clonage du dépot awx-on-k3s
git:
repo: https://github.com/kurokobo/awx-on-k3s.git
dest: "{{ awx_dir }}"
clone: yes
force: yes
- name: Git checkout
ansible.builtin.shell: "git checkout 2.10.0"
args:
chdir: "{{ awx_dir }}"
- name: Deploiement AWX Operator ...
ansible.builtin.shell: "kubectl apply -k operator"
args:
chdir: "{{ awx_dir }}"
#- name: Git checkout
#ansible.builtin.git:
#repo: 'https://github.com/kurokobo/awx-on-k3s.git'
#dest: "{{ awx_dir }}"
#version: release-2.10.0
- name: Generation de certificat auto-signé avec OpenSSL
ansible.builtin.shell: 'openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -out ./base/tls.crt -keyout ./base/tls.key -subj "/CN={{ awx_host }}/O={{ awx_host }}" -addext "subjectAltName = DNS:{{ awx_host }}"'
args:
chdir: "{{ awx_dir }}"
- name: Changement de la ligne hostname dans le fichier awx.yaml
replace:
path: ~/tools/awx-on-k3s/base/awx.yaml
regexp: 'awx.example.com'
replace: '{{ awx_host }}'
backup: yes
- name: creation du repertoire postgres-13
ansible.builtin.file:
path: /data/postgres-13
state: directory
mode: '0755'
- name: Creation repertoire projects
ansible.builtin.file:
path: /data/projects
state: directory
owner: 1000:0
- name: Deploiement d'AWX ...
ansible.builtin.shell: "kubectl apply -k base"
args:
chdir: "{{ awx_dir }}"
- name: Test d'accésibilité de l'interface web AWX
ansible.builtin.uri:
url: "https://s-awx.gsb.lan"
follow_redirects: none
method: GET
validate_certs: false
register: _result
until: _result.status == 200
retries: 60 # 90*10 seconds = 15 min
delay: 10 # Every 10 seconds
- debug:
msg: "L'installation du serveur AWX est terminée."
- debug:
msg: "Connectez-vous sur: https://s-awx.gsb.lan"
- debug:
msg: "Nom d'utilisateur: admin / mdp: Ansible123!"