Compare commits

...

3 Commits

Author SHA1 Message Date
b812948257 role AWX 2024-01-30 12:54:38 +01:00
88061eb89d reorganisation du role s-awx et s-awx-post 2024-01-30 11:55:30 +01:00
6fbad9d9fa MAJ role AWX 2024-01-30 11:38:16 +01:00
8 changed files with 83 additions and 100 deletions

6
goss/s-awx.yaml Normal file
View File

@ -0,0 +1,6 @@
interface:
enp0s8:
exists: true
addrs:
- 172.16.0.22/24
mtu: 1500

View File

@ -1,21 +1,26 @@
# Rôle Kea
# Rôle awx
***
Rôle Kea: Configuration de 2 serveurs KEA en mode haute disponbilité.
Rôle awx: Configuration d'un serveur AWX avec k3s.
## Tables des matières
1. [Que fait le rôle Kea ?]
2. [Installation et configuration de ka]
3. [Remarques]
1. [Que fait le rôle AWX ?]
2. [Connexion à l'interface WEB du serveur AWX]
**AWX** est l'application développée par **RedHat** permettant de lancer des playbooks **ansible** depuis une interface web évoluée plutôt qu'en ligne de commande. **AWX** utlise kubernetes mise en oeuvre ici avec **k3s**.
## Que fait le rôle Kea ?
Le rôle KEA permet de configurer 1 serveurs kea (s-kea1 et s-kea2) en mode haute disponibilité.
- Le serveur **s-kea1** sera en mode **primary** il délivrera les baux DHCP sur le réseau n-user.
- Le serveur **s-kea2**, sera en mode **stand-by** le service DHCP basculera donc sur **s-kea2** en cas disponibilité du serveur**s-kea1**.
## Que fait le rôle AWX ?
Le rôle **awx** installe et configure un serveur **AWX** avec **k3s** pour cela le role:
- Installe **k3s** en spécifiant l'adresse IP ainsi que l'interface d'écoute
- Clone le dépot **Github** **awx-on-k3s**
- Procéde au déploiement du pod **awx-operator**
- Génére un certifiacat auto-signé utlisée par le serveur **AWX** en utilisant **OpenSSL**
- Edite le fichier awx.yaml afin d'y indique le nom d'hote du serveur en accord avec le nom utlisé par les certificats
- Déploie le serveur **AWX**
- Test l'accésibilité du serveur **AWX**.
### Installation et configuration de kea
### Connexions à l'interface WEB du serveur AWX ###
Une fois le role **awx** terminé il est possible de se connecter à l'interface web duserveur depuis un navigateur.
S'assurer que votre machine puisse résoudre **s-awx.gsb.lan**
- Se connecter sur : **https://s-awx.gsb.lan**
- Utlisateur: **admin** / Mot de passe: **Ansible123!**
Le rôle kea installe les packets **kea dhcp4, hooks, admin** une fois les packets installer. Il configure un serveur kea pour qu'il distribue les ips sur le réseau n-user et soit en haute disponibilité.
### Remarquees ###
Une fois le playbook **s-kea** correctement terminé et la machine **s-kea** redemarrée, redémarrée le service **isc-kea-dhcp4.service** afin de prendre en compte les modifications éfféctuées sur la couche réseau par le role POST.

View File

@ -1,8 +0,0 @@
#variable kea
kea_ver: "2.4.1"
kea_dbname: ""
kaa_dbuser: ""
kea_dbpasswd: ""
kea_dhcp4_dir: "/etc/kea/kea-dhcp4.conf"
kea_ctrl_dir: "/etc/kea/kea-ctrl-agent.conf"

View File

@ -1,6 +0,0 @@
---
- name: Restart isc-stork-server.service
ansible.builtin.service:
name: isc-stork-server.service
state: restarted
enabled: yes

View File

@ -1,29 +1,42 @@
---
- name: Preparation
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 }}" --flanel-iface "{{ awx_if }}"
- 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
- 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: 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 certification auto-signé
- 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 }}"
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:
@ -42,6 +55,25 @@
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!"

View File

@ -1,52 +0,0 @@
### database settings
### the address of a PostgreSQL database
STORK_DATABASE_HOST=localhost
### the port of a PostgreSQL database
STORK_DATABASE_PORT=5432
### the name of a database
STORK_DATABASE_NAME={{ stork_db_name }}
### the username for connecting to the database
STORK_DATABASE_USER_NAME={{ stork_db_user }}
### the SSL mode for connecting to the database
### possible values: disable, require, verify-ca, or verify-full
# STORK_DATABASE_SSLMODE=
### the location of the SSL certificate used by the server to connect to the database
# STORK_DATABASE_SSLCERT=
### the location of the SSL key used by the server to connect to the database
# STORK_DATABASE_SSLKEY=
### the location of the root certificate file used to verify the database server's certificate
# STORK_DATABASE_SSLROOTCERT=
### the password for the username connecting to the database
### empty password is set to avoid prompting a user for database password
STORK_DATABASE_PASSWORD={{stork_db_passwd }}
### REST API settings
### the IP address on which the server listens
# STORK_REST_HOST=
### the port number on which the server listens
# STORK_REST_PORT=
### the file with a certificate to use for secure connections
# STORK_REST_TLS_CERTIFICATE=
### the file with a private key to use for secure connections
# STORK_REST_TLS_PRIVATE_KEY=
### the certificate authority file used for mutual TLS authentication
# STORK_REST_TLS_CA_CERTIFICATE=
### the directory with static files served in the UI
STORK_REST_STATIC_FILES_DIR=/usr/share/stork/www
### the base URL of the UI - to be used only if the UI is served from a subdirectory
# STORK_REST_BASE_URL=
### enable Prometheus /metrics HTTP endpoint for exporting metrics from
### the server to Prometheus. It is recommended to secure this endpoint
### (e.g. using HTTP proxy).
# STORK_SERVER_ENABLE_METRICS=true
### Logging parameters
### Set logging level. Supported values are: DEBUG, INFO, WARN, ERROR
# STORK_LOG_LEVEL=DEBUG
### disable output colorization
# CLICOLOR=false
### path to the hook directory
# STORK_SERVER_HOOK_DIRECTORY=

11
s-awx-post.yml Normal file
View File

@ -0,0 +1,11 @@
---
- hosts: localhost
connection: local
vars:
awx_host: "s-awx.gsb.lan"
awx_dir: "/root/tools/awx-on-k3s"
awx_ip: "172.16.0.22"
awx_if: "enp0s8"
roles:
- awx

View File

@ -2,16 +2,11 @@
- hosts: localhost
connection: local
vars:
awx_host: "s-awx.gsb.lan"
awx_dir: "/root/tools/awx-on-k3s"
awx_ip: "192.168.0.2"
awx_if: "enp0s3"
roles:
- base
# - goss
#- ssh-cli
- awx
- goss
- ssh-cli
#- awx
# - zabbix-cli
#- journald-snd
#- post
- journald-snd
- post