Skip to content

Commit

Permalink
Add sync and index option on respective roles to conditionally sync o…
Browse files Browse the repository at this point in the history
…r index (#207)
  • Loading branch information
Tompage1994 authored Jan 21, 2023
1 parent 13fe70c commit 7bd32f0
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions changelogs/fragments/sync-index.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
breaking_changes:
- Introduces a `sync` option to the ee_registry_sync role on the `ah_ee_registries` variable which by default is false and which is required true to sync the registry.
- Introduces an `index` option to the ee_registry_index role on the `ah_ee_registries` variable which by default is false and which is required true to index the registry.
...
3 changes: 2 additions & 1 deletion roles/ee_registry_index/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ An Ansible Role to index EE Registries in Automation Hub.
|`ah_password`|""|yes|Automation Hub Admin User's password on the Automation Hub Server. This should be stored in an Ansible Vault at vars/tower-secrets.yml or elsewhere and called from a parent playbook.||
|`ah_validate_certs`|`False`|no|Whether or not to validate the Ansible Automation Hub Server's SSL certificate.||
|`ah_path_prefix`|""|no|API path used to access the api. Either galaxy, automation-hub, or custom||
|`ah_ee_registries`|`see below`|yes|Data structure describing your ee_registries, described below. (Note this is the same as for the `ee_registries` role and the variable can be combined)||
|`ah_ee_registries`|`see below`|yes|Data structure describing your ee_registries, described below. (Note this is the same as for the `ee_registries` role and the variable can be combined). Note that this role will only do anything if the `index` suboption of this variable is set to true.||

### Secure Logging Variables

Expand Down Expand Up @@ -48,6 +48,7 @@ This also speeds up the overall role.
|Variable Name|Default Value|Required|Type|Description|
|:---:|:---:|:---:|:---:|:---:|
|`name`|""|yes|str|Registry name. Must be lower case containing only alphanumeric characters and underscores.|
|`index`|false|no|bool|Whether to index the ee_registry. Bu default it will not index unless this is set to true.|
|`wait`|true|no|str|Whether to wait for the indexing to complete|
|`interval`|`ah_configuration_ee_registry_index_async_delay`|no|str|The interval which the indexing task will be checked for completion|
|`timeout`|""|no|str|How long to wait for the indexing task to complete|
Expand Down
1 change: 1 addition & 0 deletions roles/ee_registry_index/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
loop: "{{ ah_ee_registries }}"
loop_control:
loop_var: "__ee_registry_item"
when: __ee_registry_item.index | default(false)
no_log: "{{ ah_configuration_ee_registry_secure_logging }}"
async: 1000
poll: 0
Expand Down
3 changes: 2 additions & 1 deletion roles/ee_registry_sync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ An Ansible Role to sync EE Registries in Automation Hub.
|`ah_password`|""|yes|Automation Hub Admin User's password on the Automation Hub Server. This should be stored in an Ansible Vault at vars/tower-secrets.yml or elsewhere and called from a parent playbook.||
|`ah_validate_certs`|`False`|no|Whether or not to validate the Ansible Automation Hub Server's SSL certificate.||
|`ah_path_prefix`|""|no|API path used to access the api. Either galaxy, automation-hub, or custom||
|`ah_ee_registries`|`see below`|yes|Data structure describing your ee_registries, described below. (Note this is the same as for the `ee_registries` role and the variable can be combined||
|`ah_ee_registries`|`see below`|yes|Data structure describing your ee_registries, described below. (Note this is the same as for the `ee_registries` role and the variable can be combined. Note that this role will only do anything if the `sync` suboption of this variable is set to true.||

### Secure Logging Variables

Expand Down Expand Up @@ -48,6 +48,7 @@ This also speeds up the overall role.
|Variable Name|Default Value|Required|Type|Description|
|:---:|:---:|:---:|:---:|:---:|
|`name`|""|yes|str|Registry name. Must be lower case containing only alphanumeric characters and underscores.|
|`sync`|false|no|bool|Whether to sync the ee_registry. By default it will not sync unless this is set to true.|
|`wait`|true|no|str|Whether to wait for the sync to complete|
|`interval`|`ah_configuration_ee_registry_sync_async_delay`|no|str|The interval which the sync task will be checked for completion|
|`timeout`|""|no|str|How long to wait for the sync task to complete|
Expand Down
1 change: 1 addition & 0 deletions roles/ee_registry_sync/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
loop: "{{ ah_ee_registries }}"
loop_control:
loop_var: "__ee_registry_item"
when: __ee_registry_item.sync | default(false)
no_log: "{{ ah_configuration_ee_registry_secure_logging }}"
async: 1000
poll: 0
Expand Down

0 comments on commit 7bd32f0

Please sign in to comment.