From 827c4cf62e7e6bb27ec9887a75c3f74497a3171c Mon Sep 17 00:00:00 2001 From: ePietry Date: Wed, 27 Mar 2024 15:29:52 +0100 Subject: [PATCH] update external vars --- ansible/README.MD | 22 +++++++++++++++++----- ansible/playbooks/initial_ostree.yaml | 1 + ansible/playbooks/repo_creation.yml | 1 + 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ansible/README.MD b/ansible/README.MD index c15fe2a..f1c3224 100644 --- a/ansible/README.MD +++ b/ansible/README.MD @@ -91,16 +91,27 @@ Find the IP address of the current server. ```sh MYIP="$(ip -4 -br addr show scope global | awk 'NR == 1 { split($3, parts, "/"); print parts[1]; }')" ``` +## Ansible Config + +Create a `inventory.yaml` file inside the Ansible folder or define the inventory path inside the `ansible.cfg` file +Create a `config.yaml` file inside the Ansible folder following this model: +```yaml +blueprint: #name of the blueprint you want to use form the ansible/bluprint folder. EXAMPLE blueprint: blueprint_example.toml +repo_location: #EXAMPLE repo_location: /opt/custom-rpms/ +ADMIN_SSH_PUBLIC_KEY: # ssh-rsa AA... +ADMIN_PASSWORD: +``` + ## Create the initial ostree repo -Create a `inventory.yaml` file inside the Ansible folder or define the inventory path inside the `ansible.cfg` file Add blueprint file into the blueprint folder or use the `blueprint_example.toml` +The blueprint use in this opperation is define in `config.yaml` as `blueprint:` Create the initial ostree repo using `blueprint_example.toml` use the following command: ``` -ansible-playbook playbooks/initial_ostree.yaml -e blueprint=blueprint_example.toml +ansible-playbook playbooks/initial_ostree.yaml ``` @@ -112,11 +123,12 @@ ansible-playbook playbooks/build_RPMS.yaml ``` ## Repository Creation -to build a repository containing the RPMS we created, run the `repo_creation.yaml` playbook and indicate the desiered repo directory using the `-e` argument. +To build a repository containing the RPMS we created, run the `repo_creation.yaml` playbook +The directory where the repo is created is define in `config.yaml` as `repo_location:` -For instance to create repository in the `/opt/custom-rpms/` directory use : +To start tge build, run : ``` -ansible-playbook playbooks/repo_creation.yaml -e repo_location=/opt/custom-rpms/ +ansible-playbook playbooks/repo_creation.yaml ``` diff --git a/ansible/playbooks/initial_ostree.yaml b/ansible/playbooks/initial_ostree.yaml index a6398fb..3c0f1f5 100755 --- a/ansible/playbooks/initial_ostree.yaml +++ b/ansible/playbooks/initial_ostree.yaml @@ -1,6 +1,7 @@ - name: Create the initial ostree repo hosts: all become: true + vars_files: ../config.yaml tasks: - name: Create Blueprint /tmp/blueprints repo ansible.builtin.file: diff --git a/ansible/playbooks/repo_creation.yml b/ansible/playbooks/repo_creation.yml index 04fa4ae..1da2d24 100644 --- a/ansible/playbooks/repo_creation.yml +++ b/ansible/playbooks/repo_creation.yml @@ -1,6 +1,7 @@ --- - name: Create a custom RPM repository hosts: all + vars_files: ../config.yaml tasks: - name: Install createrepo package become: true