Browse Source

Add Ansible

ca-cert-and-multi-ks
Ernest Pietryka 2 years ago
parent
commit
27ff4243f2
  1. 2
      ansible/ansible.cfg
  2. 7
      ansible/inventory.yaml
  3. 6
      ansible/playbooks-test.yaml
  4. 3
      ansible/playbooks/.vscode/settings.json
  5. 5
      ansible/playbooks/blueprint.vars
  6. 44
      ansible/playbooks/initial_ostree.yaml
  7. 31
      ansible/playbooks/setup.yaml

2
ansible/ansible.cfg

@ -0,0 +1,2 @@
[defaults]
inventory= inventory.yaml

7
ansible/inventory.yaml

@ -0,0 +1,7 @@
aws:
hosts:
192.168.122.45:
vars:
ansible_port: 22
ansible_user: epietryk
ansible_key_file: /home/epietryk/.ssh/edge

6
ansible/playbooks-test.yaml

@ -0,0 +1,6 @@
---
- name: ping all inventory
hosts: all
tasks:
- name: ping
ansible.builtin.ping:

3
ansible/playbooks/.vscode/settings.json

@ -0,0 +1,3 @@
{
"ansible.python.interpreterPath": "/bin/python"
}

5
ansible/playbooks/blueprint.vars

@ -0,0 +1,5 @@
builder_blueprint_name: "minimal-rhel9"
builder_blueprint_description: "minimal blueprint for ostree commit"
builder_blueprint_distro: rhel-93
builder_blueprint_customizations:
version: "1.1.0"

44
ansible/playbooks/initial_ostree.yaml

@ -0,0 +1,44 @@
- name: Create the initial ostree repo
hosts: all
become: true
vars_files:
- blueprint.vars
tasks:
- name: Add user to weldr group
ansible.builtin.user:
name: "{{ ansible_user_id }}"
groups: weldr
append: true
# - name: Create a blueprint
# infra.osbuild.create_blueprint:
# dest: "/home/epietryk/blueprint/blueprint.toml"
# name: "rhel-edge-blueprint"
# description: "{{ builder_blueprint_description }}"
# distro: "{{ builder_blueprint_distro }}"
# groups: "{{ builder_blueprint_groups }}"
# packages: "{{ builder_blueprint_packages }}"
# customizations: "{{ builder_blueprint_customizations }}"
- name: Push a blueprint
infra.osbuild.push_blueprint:
src: "/home/epietryk/blueprint/blueprint.toml"
- name: Start ostree compose with idempotent transaction
infra.osbuild.start_compose:
blueprint: rhel-edge-blueprint
allow_duplicate: true
register: builder_compose_start_out
- name: Print compose UUID
ansible.builtin.debug:
var: builder_compose_start_out
- name: Wait for compose to finish
infra.osbuild.wait_compose:
compose_id: "{{ builder_compose_start_out['result']['body']['build_id'] }}"
timeout: 3600
- name: Create /tmp repo
ansible.builtin.file:
path: /tmp/images/
mode: '0755'
state: directory
- name: Export the compose artifact
infra.osbuild.export_compose: # noqa only-builtins
compose_id: "{{ builder_compose_start_out['result']['body']['build_id'] }}"
dest: /tmp/images/{{ builder_compose_start_out['result']['body']['build_id'] }}.tar

31
ansible/playbooks/setup.yaml

@ -0,0 +1,31 @@
- name: Setup VM
hosts: all
become: true
tasks:
- name: Install software
ansible.builtin.dnf:
name:
- osbuild-composer
- composer-cli
- cockpit-composer
- git
- podman
- buildah
- nginx
- firewalld
state: present
- name: Config services
ansible.builtin.service:
name: "{{ item }}"
state: started
enabled: true
loop:
- osbuild-composer.socket
- cockpit.socket
- nginx.service
- firewalld
- name: Add user to weldr group
ansible.builtin.user:
name: "{{ ansible_user_id }}"
groups: weldr
append: true
Loading…
Cancel
Save