Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moved defaults example vars to playbook #265

Merged
merged 8 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/265-move-defaults-to-playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- Moved default vars to populate aap playbook for better availability.
72 changes: 72 additions & 0 deletions playbooks/osbuild_populate_aap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,75 @@
- name: Run the role
ansible.builtin.import_role:
name: infra.osbuild.populate_aap
vars:
controller_hostname: https://0.0.0.0 # noqa var-naming[no-role-prefix]
controller_username: admin # noqa var-naming[no-role-prefix]
controller_password: test # noqa var-naming[no-role-prefix]
populate_aap_default_host_user: user
populate_aap_default_host_ip: 0.0.0.0
populate_aap_organizations:
- name: "{{ populate_aap_organization_name }}"
populate_aap_execution_environments:
- name: "{{ populate_aap_execution_environment_name }}"
image: quay.io/repository/osbuildee/osbuildee
pull: always
organization: "{{ populate_aap_organization_name }}"
populate_aap_inventories:
- name: "{{ populate_aap_inventory_name }}"
organization: "{{ populate_aap_organization_name }}"
populate_aap_hosts:
- name: osbuild_remote_system
inventory: "{{ populate_aap_inventory_name }}"
variables:
ansible_host: "{{ populate_aap_default_host_ip }}"
ansible_user: "{{ populate_aap_default_host_user }}"
populate_aap_projects:
- name: "{{ populate_aap_project_name }}"
organization: "{{ populate_aap_organization_name }}"
default_environment: "{{ populate_aap_execution_environment_name }}"
scm_type: git
scm_url: https://github.com/redhat-cop/infra.osbuild
populate_aap_credentials:
- name: "{{ populate_aap_credential_name }}"
organization: "{{ populate_aap_organization_name }}"
credential_type: Machine
inputs:
username: "{{ populate_aap_default_host_user }}"
ssh_key_data: "{{ lookup('file', populate_aap_ssh_key_path) if populate_aap_ssh_key_path is defined else '' }}"
populate_aap_job_templates:
- name: osbuild_setup_server
job_type: run
inventory: "{{ populate_aap_inventory_name }}"
project: "{{ populate_aap_project_name }}"
playbook: playbooks/osbuild_setup_server.yml
credentials:
- "{{ populate_aap_credential_name }}"

- name: osbuild_builder
job_type: run
inventory: "{{ populate_aap_inventory_name }}"
project: "{{ populate_aap_project_name }}"
playbook: playbooks/osbuild_builder.yml
survey_enabled: true
survey: "{{ lookup('template', 'template_surveys/builder_survey.yml') | from_yaml }}"
ask_variables_on_launch: true
extra_vars:
_docs: 'REPLACE WITH VARS FROM DOCS: https://github.com/redhat-cop/infra.osbuild/blob/main/roles/builder/APP_EXTRA_VARS.md' # yamllint disable-line rule:line-length
credentials:
- "{{ populate_aap_credential_name }}"

- name: osbuild_system_info
job_type: run
inventory: "{{ populate_aap_inventory_name }}"
project: "{{ populate_aap_project_name }}"
playbook: playbooks/osbuild_system_info.yml
credentials:
- "{{ populate_aap_credential_name }}"

- name: osbuild_update_system
job_type: run
inventory: "{{ populate_aap_inventory_name }}"
project: "{{ populate_aap_project_name }}"
playbook: playbooks/osbuild_update_system.yml
credentials:
- "{{ populate_aap_credential_name }}"
98 changes: 96 additions & 2 deletions roles/populate_aap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,27 @@ None
|`populate_aap_credentials`|None|no|list|Use to populate AAP with credentials. More information can be found in [Configuration Collection credentials role README](https://github.com/redhat-cop/controller_configuration/tree/devel/roles/credentials)|<pre>populate_aap_credentials:<br> - name: osbuild_credential<br> organization: Osbuild_test<br> credentail_type: Machine<br> inputs:<br> username: user<br> ssh_key_data: "{{ lookup('file', '~/.ssh/id_rsa_aap', errors='warn') }}" </pre>|
|`populate_aap_job_templates`|None|no|list|Use to populate AAP with job templates. More information can be found in [Configuration Collection job templates role README](https://github.com/redhat-cop/controller_configuration/tree/devel/roles/job_templates)|<pre>populate_aap_job_templates:<br> - name: osbuild_setup_server<br> job_type: run<br> inventory: osbuild_inventory<br> project: osbuild_project<br> playbook: playbooks/<br> osbuild_setup_server.yml<br> credentials:<br> - osbuild_credential</pre>|

### populate_aap_default_host_user

Type: string
Required: false

Default host user for the remote system.

### populate_aap_default_host_ip

Type: string
Required: false

Default ip for the remote system.

### populate_aap_ssh_key_path

Type: string
Required: false

Path to the private ssh key that will be used for communication remote systems.

## Variables Exported by the Role

None.
Expand All @@ -38,12 +59,85 @@ None.
```yaml
---
- name: Run populate_aap role to populate AAP with infra.osbuild content
become: true
hosts: all
hosts: localhost
connection: local
gather_facts: false
tasks:
- name: Run the role
ansible.builtin.import_role:
name: infra.osbuild.populate_aap
vars:
controller_hostname: https://0.0.0.0 # noqa var-naming[no-role-prefix]
controller_username: admin # noqa var-naming[no-role-prefix]
controller_password: test # noqa var-naming[no-role-prefix]
populate_aap_default_host_user: user
populate_aap_default_host_ip: 0.0.0.0
populate_aap_organizations:
- name: "{{ populate_aap_organization_name }}"
populate_aap_execution_environments:
- name: "{{ populate_aap_execution_environment_name }}"
image: quay.io/repository/osbuildee/osbuildee
pull: always
organization: "{{ populate_aap_organization_name }}"
populate_aap_inventories:
- name: "{{ populate_aap_inventory_name }}"
organization: "{{ populate_aap_organization_name }}"
populate_aap_hosts:
- name: osbuild_remote_system
inventory: "{{ populate_aap_inventory_name }}"
variables:
ansible_host: "{{ populate_aap_default_host_ip }}"
ansible_user: "{{ populate_aap_default_host_user }}"
populate_aap_projects:
- name: "{{ populate_aap_project_name }}"
organization: "{{ populate_aap_organization_name }}"
default_environment: "{{ populate_aap_execution_environment_name }}"
scm_type: git
scm_url: https://github.com/redhat-cop/infra.osbuild
populate_aap_credentials:
- name: "{{ populate_aap_credential_name }}"
organization: "{{ populate_aap_organization_name }}"
credential_type: Machine
inputs:
username: "{{ populate_aap_default_host_user }}"
ssh_key_data: "{{ lookup('file', populate_aap_ssh_key_path) if populate_aap_ssh_key_path is defined else '' }}"
populate_aap_job_templates:
- name: osbuild_setup_server
job_type: run
inventory: "{{ populate_aap_inventory_name }}"
project: "{{ populate_aap_project_name }}"
playbook: playbooks/osbuild_setup_server.yml
credentials:
- "{{ populate_aap_credential_name }}"

- name: osbuild_builder
job_type: run
inventory: "{{ populate_aap_inventory_name }}"
project: "{{ populate_aap_project_name }}"
playbook: playbooks/osbuild_builder.yml
survey_enabled: true
survey: "{{ lookup('template', 'template_surveys/builder_survey.yml') | from_yaml }}"
ask_variables_on_launch: true
extra_vars:
_docs: 'REPLACE WITH VARS FROM DOCS: https://github.com/redhat-cop/infra.osbuild/blob/main/roles/builder/APP_EXTRA_VARS.md' # yamllint disable-line rule:line-length
credentials:
- "{{ populate_aap_credential_name }}"

- name: osbuild_system_info
job_type: run
inventory: "{{ populate_aap_inventory_name }}"
project: "{{ populate_aap_project_name }}"
playbook: playbooks/osbuild_system_info.yml
credentials:
- "{{ populate_aap_credential_name }}"

- name: osbuild_update_system
job_type: run
inventory: "{{ populate_aap_inventory_name }}"
project: "{{ populate_aap_project_name }}"
playbook: playbooks/osbuild_update_system.yml
credentials:
- "{{ populate_aap_credential_name }}"
```

## License
Expand Down
72 changes: 1 addition & 71 deletions roles/populate_aap/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,78 +1,8 @@
---
controller_hostname: https://0.0.0.0
controller_username: admin
controller_password: test
controller_validate_certs: false
controller_configuration_async_retries: 30
populate_aap_organization_name: Osbuild_org
populate_aap_organization_name: osbuild_org
populate_aap_execution_environment_name: osbuild_ee
populate_aap_inventory_name: osbuild_inventory
populate_aap_project_name: osbuild_project
populate_aap_credential_name: osbuild_credential
populate_aap_organizations:
- name: "{{ populate_aap_organization_name }}"
populate_aap_execution_environments:
- name: "{{ populate_aap_execution_environment_name }}"
image: quay.io/repository/osbuildee/osbuildee
pull: always
organization: "{{ populate_aap_organization_name }}"
populate_aap_inventories:
- name: "{{ populate_aap_inventory_name }}"
organization: "{{ populate_aap_organization_name }}"
populate_aap_hosts:
- name: osbuild_remote_system
inventory: "{{ populate_aap_inventory_name }}"
variables:
ansible_host: 0.0.0.0
ansible_user: user
populate_aap_projects:
- name: "{{ populate_aap_project_name }}"
organization: "{{ populate_aap_organization_name }}"
default_environment: "{{ populate_aap_execution_environment_name }}"
scm_type: git
scm_url: https://github.com/redhat-cop/infra.osbuild
populate_aap_credentials:
- name: "{{ populate_aap_credential_name }}"
organization: "{{ populate_aap_organization_name }}"
credential_type: Machine
inputs:
username: user
ssh_key_data: "{{ lookup('file', '/home/user/.ssh/id_rsa') }}"
populate_aap_job_templates:
- name: osbuild_setup_server
job_type: run
inventory: "{{ populate_aap_inventory_name }}"
project: "{{ populate_aap_project_name }}"
playbook: playbooks/osbuild_setup_server.yml
credentials:
- "{{ populate_aap_credential_name }}"

- name: osbuild_builder
job_type: run
inventory: "{{ populate_aap_inventory_name }}"
project: "{{ populate_aap_project_name }}"
playbook: playbooks/osbuild_builder.yml
survey_enabled: true
survey: "{{ lookup('template', 'template_surveys/builder_survey.yml') | from_yaml }}"
ask_variables_on_launch: true
extra_vars:
_docs: 'REPLACE WITH VARS FROM DOCS: https://github.com/redhat-cop/infra.osbuild/blob/main/roles/builder/APP_EXTRA_VARS.md' # yamllint disable-line rule:line-length

credentials:
- "{{ populate_aap_credential_name }}"

- name: osbuild_system_info
job_type: run
inventory: "{{ populate_aap_inventory_name }}"
project: "{{ populate_aap_project_name }}"
playbook: playbooks/osbuild_system_info.yml
credentials:
- "{{ populate_aap_credential_name }}"

- name: osbuild_update_system
job_type: run
inventory: "{{ populate_aap_inventory_name }}"
project: "{{ populate_aap_project_name }}"
playbook: playbooks/osbuild_update_system.yml
credentials:
- "{{ populate_aap_credential_name }}"