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

Update for new infra release #366

Merged
merged 22 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
139ab1d
Update pre-commit (#326)
github-actions[bot] Oct 22, 2023
040b4c6
Update pre-commit
branic Nov 7, 2023
d291232
Fix ansible-lint running against .py files (#332)
Tompage1994 Nov 12, 2023
faae504
Update description in the user role README (#333)
rjo-uk Nov 12, 2023
19bc192
Fix version comparison (#337)
rochacbruno Nov 17, 2023
e5eb1e9
Update pre-commit (#338)
github-actions[bot] Nov 21, 2023
06fb654
user: Fix password type field in README (#342)
dsavineau Nov 27, 2023
9d2024d
update repository roles (#343)
sean-m-sullivan Nov 29, 2023
182d93f
Update pre-commit (#344)
github-actions[bot] Nov 30, 2023
c1549d7
Fix wording to sync (#345)
dbk-rabel Dec 12, 2023
4f16398
Update pre-commit
branic Jan 5, 2024
1ff2d1e
Fix markdown tables (#349)
Tompage1994 Jan 15, 2024
36b8e01
Update pre-commit (#348)
github-actions[bot] Jan 15, 2024
ec01b38
Update pre-commit
branic Jan 19, 2024
c8ee836
collection_remote: set sync_dependencies default to PAH default (#346)
dbk-rabel Jan 30, 2024
96f27df
Fix typo in ah_group_roles variable
m8ram Feb 7, 2024
aba612d
Add branch specifics to Contributing guide (#360)
Tompage1994 Feb 9, 2024
f9235ec
Fix documentation for validate_certs (#364)
Tompage1994 Feb 20, 2024
1777cfd
Fixed issue in all roles where AH_HOST was not being defaulted to if …
Tompage1994 Feb 20, 2024
d660166
Fix documentation for group_roles role (#359)
Tompage1994 Feb 20, 2024
c633dca
Update pre-commit (#361)
github-actions[bot] Feb 27, 2024
621f9a3
Merge branch 'infra_release_2.0.4' into infra_conflict_branch
sean-m-sullivan Feb 27, 2024
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
1 change: 1 addition & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ exclude_paths:
- '.github/'
- 'roles/master_role_example/'
- 'changelogs/'
- '*.py'
parseable: true
use_default_rules: true
# https://github.com/ansible/ansible-lint/issues/808
Expand Down
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ Please see pre-commit documentation for further explanation: [Pre-commit](https:
If you feel like getting your hands dirty, feel free to make the change yourself. Here's how:

1. Fork the repo on Github, and then clone it locally.
2. Create a branch named appropriately for the change you are going to make.
2. Create a branch named appropriately for the change you are going to make. Ensure this branch starts from an up to date pull of the `devel` branch (the default branch).
3. Make your code change.
4. If you are creating a new role, please add a test for it in our [testing playbooks.](https://github.com/redhat-cop/ah_configuration/blob/devel/playbooks/) by adding a new role entry and adding the appropriate yaml file with test data in the ah_configs directory.
5. Add a changelog fragment in `changelogs/fragments` as per <https://docs.ansible.com/ansible/latest/community/development_process.html#changelogs>
6. Push your code change up to your forked repo.
7. Open a Pull Request to merge your changes to this repo. The comment box will be filled in automatically via a template.
7. Open a Pull Request to merge your changes to this repo (against the `devel` branch). The comment box will be filled in automatically via a template.
8. All Pull Requests will be subject to Ansible and Yaml Linting checks. Please make sure that your code complies and fix any warnings that arise. These are checks that appear at the bottom of your Pull Request.
9. All Pull requests are subject to Testing against being used in automation hub. As above there is a check at the bottom of your pull request for this named integration.

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ Include a [minimum complete verifiable example] with:

<!--- HINT: You can paste gist.github.com links for larger files -->

[minimum complete verifiable example]: http://stackoverflow.com/help/mcve
<!-- See a minimum complete verifiable example here: http://stackoverflow.com/help/mcve -->
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: 'https://github.com/ansible-community/ansible-lint.git'
rev: v6.20.3
rev: v24.2.0
hooks:
# see discussions here about what arguments are used, and behavior
# https://github.com/ansible/ansible-lint/issues/649
Expand All @@ -19,11 +19,11 @@ repos:
args:
- "--profile=production"
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.10.0
rev: v0.12.1
hooks:
- id: markdownlint-cli2
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
name: flake8
Expand Down
4 changes: 4 additions & 0 deletions changelogs/fragments/ah_host_env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
bugfixes:
- Fixed issue in all roles where AH_HOST was not being defaulted to if no variable set.
...
9 changes: 6 additions & 3 deletions plugins/module_utils/ah_api_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import time

from ansible.module_utils.basic import AnsibleModule, env_fallback
from ansible.module_utils.compat.version import LooseVersion as Version
from ansible.module_utils._text import to_bytes, to_text

from ansible.module_utils.six.moves.urllib.parse import urlparse, urlencode
Expand Down Expand Up @@ -485,9 +486,9 @@ def exit_json(self, **kwargs):
def get_server_version(self):
"""Return the automation hub/galaxy server version.

:return: the server version ("4.2.5" for example) or an empty string if
:return: the server Version("4.2.5") for example or Version("0") if
that information is not available.
:rtype: str
:rtype: Version
"""
url = self._build_url(self.galaxy_path_prefix)
try:
Expand All @@ -501,4 +502,6 @@ def get_server_version(self):
else:
fail_msg = "Unable to get server version: {code}".format(code=response["status_code"])
self.fail_json(msg=fail_msg)
return response["json"]["server_version"].replace('dev', '') if "server_version" in response["json"] else ""
return Version(
response["json"]["server_version"].replace('dev', '') if "server_version" in response["json"] else "0"
)
2 changes: 1 addition & 1 deletion plugins/module_utils/ah_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def __init__(self, argument_spec=None, direct_params=None, error_callback=None,
# Perform magic depending on whether ah_token is a string or a dict
if self.params.get("ah_token"):
token_param = self.params.get("ah_token")
if type(token_param) is dict:
if isinstance(token_param, dict):
if "token" in token_param:
self.oauth_token = self.params.get("ah_token")["token"]
else:
Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/collection_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
description:
- Whether to download depenencies when syncing collections.
type: bool
default: False
default: True
proxy_url:
description:
- Proxy URL to use for the connection
Expand Down Expand Up @@ -202,7 +202,7 @@ def main():
max_retries=dict(type='int', default=0),
rate_limit=dict(type='int', default=8),
signed_only=dict(type="bool", default=False),
sync_dependencies=dict(type="bool", default=False),
sync_dependencies=dict(type="bool", default=True),
proxy_url=dict(),
proxy_username=dict(),
proxy_password=dict(no_log=True),
Expand Down
2 changes: 1 addition & 1 deletion roles/ansible_config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Currently:
|`ansible_config_group`|""|no|str|The group the resulting ansible config file or directory should have.|
|`ah_configuration_working_dir`|"/var/tmp"|no|path|Location to render the ansible config file to.|
|`automation_hub_list`|`[]`|no|list|A list of Automation hubs and galaxies to put in the ansible config, see below for details.|
|`ansible_config_list`|`[{"header":"galaxy","keypairs":[{"key":"ignore_certs","value":"{{ not (ah_validate_certs | bool) }}"}]}]`|no|list|A set of ansible config settings, a default is set, but can be overridden, see below for details.|
|`ansible_config_list`|`[{"header":"galaxy","keypairs":[{"key":"ignore_certs","value":"{{ not (ah_validate_certs \| bool) }}"}]}]`|no|list|A set of ansible config settings, a default is set, but can be overridden, see below for details.|
|`ah_token`|""|no|Tower Admin User's token on the Automation Hub Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook.||
|`ah_path_prefix`|`galaxy`|no|Tower Admin User's token on the Automation Hub Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook.||

Expand Down
4 changes: 2 additions & 2 deletions roles/collection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ An Ansible Role to update, or destroy Automation Hub Collections.
|`ah_host`|""|yes|URL to the Automation Hub or Galaxy Server. (alias: `ah_hostname`)|127.0.0.1|
|`ah_username`|""|yes|Admin User on the Automation Hub or Galaxy Server.||
|`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_validate_certs`|`true`|no|Whether or not to validate the Ansible Automation Hub Server's SSL certificate.||
|`ah_request_timeout`|`10`|no|Specify the timeout Ansible should use in requests to the Galaxy or Automation Hub host.||
|`ah_path_prefix`|""|no|API path used to access the api. Either galaxy, automation-hub, or custom||
|`ah_configuration_async_dir`|`null`|no|Sets the directory to write the results file for async tasks. The default value is set to `null` which uses the Ansible Default of `/root/.ansible_async/`.||
|`ah_collections`|`null`|`no`|`see below`|yes|Data structure describing your collections, described below.||
|`ah_collections`|`see below`|yes|Data structure describing your collections, described below.||

These are the sub options for the vars `ah_collections` which are dictionaries with the options you want. See examples for details.
|Variable Name|Default Value|Required|Description|Example|
Expand Down
1 change: 0 additions & 1 deletion roles/collection/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ argument_specs:
required: false
description: The path for the Automation Hub API. Usually galaxy or automation-hub unless custom set in AH settings.
ah_validate_certs:
default: true
required: false
description: Whether or not to validate the Automation Hub Server's SSL certificate.
type: str
Expand Down
2 changes: 1 addition & 1 deletion roles/collection/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
interval: "{{ __collection.interval | default(omit) }}"
overwrite_existing: "{{ __collection.overwrite_existing | default(omit) }}"
state: "{{ __collection.state | default('present') }}"
ah_host: "{{ ah_host | default(ah_hostname) }}"
ah_host: "{{ ah_host | default(ah_hostname) | default(omit) }}"
ah_username: "{{ ah_username | default(omit) }}"
ah_password: "{{ ah_password | default(omit) }}"
ah_token: "{{ ah_token | default(omit) }}"
Expand Down
6 changes: 3 additions & 3 deletions roles/collection_remote/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ An Ansible Role to create a Collection Remote Repository.
|`ah_host`|""|yes|URL to the Automation Hub or Galaxy Server. (alias: `ah_hostname`)|127.0.0.1|
|`ah_username`|""|yes|Admin User on the Automation Hub or Galaxy Server.||
|`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_validate_certs`|`true`|no|Whether or not to validate the Ansible Automation Hub Server's SSL certificate.||
|`ah_request_timeout`|`10`|no|Specify the timeout Ansible should use in requests to the Galaxy or Automation Hub host.||
|`ah_path_prefix`|""|no|API path used to access the api. Either galaxy, automation-hub, or custom||
|`ah_configuration_async_dir`|`null`|no|Sets the directory to write the results file for async tasks. The default value is set to `null` which uses the Ansible Default of `/root/.ansible_async/`.||
Expand Down Expand Up @@ -73,11 +73,11 @@ This also speeds up the overall role.
|`max_retries`|`0`|no|Retries to use when running sync. Default is 0 which does not limit.||
|`rate_limit`|`8`|no|Limits total download rate in requests per second.||
|`signed_only`|`False`|no|Only download signed collections|False|
|`sync_dependencies`|`False`|no|Whether to download depenencies when syncing collections.|False|
|`sync_dependencies`|`True`|no|Whether to download depenencies when syncing collections.|False|
|`proxy_url`|``|no|The URL for the proxy. Defaults to global `proxy_url` variable.||
|`proxy_username`|``|no|The username for the proxy authentication. Defaults to global `proxy_username` variable.||
|`proxy_password`|``|no|The password for the proxy authentication. Defaults to global `proxy_password` variable.||
|`state`|`present`|no|Desired state of the collection_remote. Either `present` or `absent`.|
|`state`|`present`|no|Desired state of the collection_remote. Either `present` or `absent`.||

### Standard Project Data Structure

Expand Down
1 change: 0 additions & 1 deletion roles/collection_remote/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ argument_specs:
required: false
description: The path for the Automation Hub API. Usually galaxy or automation-hub unless custom set in AH settings.
ah_validate_certs:
default: true
required: false
description: Whether or not to validate the Automation Hub Server's SSL certificate.
type: str
Expand Down
2 changes: 1 addition & 1 deletion roles/collection_remote/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
proxy_username: "{{ __collection_remote_item.proxy_username | default(proxy_username | default(omit)) }}"
proxy_password: "{{ __collection_remote_item.proxy_password | default(proxy_password | default(omit)) }}"
state: "{{ __collection_remote_item.state | default(ah_state | default('present')) }}"
ah_host: "{{ ah_host | default(ah_hostname) }}"
ah_host: "{{ ah_host | default(ah_hostname) | default(omit) }}"
ah_username: "{{ ah_username | default(omit) }}"
ah_password: "{{ ah_password | default(omit) }}"
ah_path_prefix: "{{ ah_path_prefix | default(omit) }}"
Expand Down
10 changes: 5 additions & 5 deletions roles/collection_repository/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ An Ansible Role to create a Collection Repository.
|`ah_host`|""|yes|URL to the Automation Hub or Galaxy Server. (alias: `ah_hostname`)|127.0.0.1|
|`ah_username`|""|yes|Admin User on the Automation Hub or Galaxy Server.||
|`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_validate_certs`|`true`|no|Whether or not to validate the Ansible Automation Hub Server's SSL certificate.||
|`ah_request_timeout`|`10`|no|Specify the timeout Ansible should use in requests to the Galaxy or Automation Hub host.||
|`ah_path_prefix`|""|no|API path used to access the api. Either galaxy, automation-hub, or custom||
|`ah_configuration_async_dir`|`null`|no|Sets the directory to write the results file for async tasks. The default value is set to `null` which uses the Ansible Default of `/root/.ansible_async/`.||
Expand Down Expand Up @@ -59,10 +59,10 @@ This also speeds up the overall role.
|`distribution`|""|no|dict|Distribution options for the collection repository. See additional options below for details. Most users will leave this blank|
|`private`|""|no|boolean|Make the Collection repository private.|
|`remote`|""|no|str|Remote repository name. This is used if the collections use a remote source.|
|`update_repo`|`false`|no|bool|Wait for the Collection repository to finish syncing before returning.||
|`wait`|`true`|no|bool|Wait for the Collection repository to finish syncing before returning.||
|`interval`|1.0|no|float|The interval to request an update from Automation Hub.||
|`timeout`|""|no|int|If waiting for the project to update this will abort after this amount of seconds.||
|`update`|`false`|no|bool|Wait for the Collection repository to finish syncing before returning.|
|`wait`|`true`|no|bool|Wait for the Collection repository to finish syncing before returning.|
|`interval`|1.0|no|float|The interval to request an update from Automation Hub.|
|`timeout`|""|no|int|If waiting for the project to update this will abort after this amount of seconds.|
|`state`|`present`|no|str|Desired state of the collection repository. Either `present` or `absent`.|

#### Addtional Option Variables
Expand Down
1 change: 0 additions & 1 deletion roles/collection_repository/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ argument_specs:
required: false
description: The path for the Automation Hub API. Usually galaxy or automation-hub unless custom set in AH settings.
ah_validate_certs:
default: true
required: false
description: Whether or not to validate the Automation Hub Server's SSL certificate.
type: str
Expand Down
2 changes: 1 addition & 1 deletion roles/collection_repository/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
interval: "{{ __collection_repository_item.interval | default(1) }}"
timeout: "{{ __collection_repository_item.timeout | default(omit) }}"
state: "{{ __collection_repository_item.state | default(ah_state | default('present')) }}"
ah_host: "{{ ah_host | default(ah_hostname) }}"
ah_host: "{{ ah_host | default(ah_hostname) | default(omit) }}"
ah_username: "{{ ah_username | default(omit) }}"
ah_password: "{{ ah_password | default(omit) }}"
ah_path_prefix: "{{ ah_path_prefix | default(omit) }}"
Expand Down
10 changes: 5 additions & 5 deletions roles/collection_repository_sync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ An Ansible Role to sync a Collection Repository.
|`ah_host`|""|yes|URL to the Automation Hub or Galaxy Server. (alias: `ah_hostname`)|127.0.0.1|
|`ah_username`|""|yes|Admin User on the Automation Hub or Galaxy Server.||
|`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_validate_certs`|`true`|no|Whether or not to validate the Ansible Automation Hub Server's SSL certificate.||
|`ah_request_timeout`|`10`|no|Specify the timeout Ansible should use in requests to the Galaxy or Automation Hub host.||
|`ah_path_prefix`|""|no|API path used to access the api. Either galaxy, automation-hub, or custom||
|`ah_configuration_async_dir`|`null`|no|Sets the directory to write the results file for async tasks. The default value is set to `null` which uses the Ansible Default of `/root/.ansible_async/`.||
Expand Down Expand Up @@ -53,9 +53,9 @@ This also speeds up the overall role.
|Variable Name|Default Value|Required|Type|Description|
|:---:|:---:|:---:|:---:|:---:|
|`name`|""|yes|str| Collection Repository name. Probably one of community, validated, rh-certified, or one you have created.|
|`wait`|`true`|no|bool|Wait for the Collection repository to finish syncing before returning.||
|`interval`|1.0|no|float|The interval to request an update from Automation Hub.||
|`timeout`|""|no|int|If waiting for the project to update this will abort after this amount of seconds.||
|`wait`|`true`|no|bool|Wait for the Collection repository to finish syncing before returning.|
|`interval`|1.0|no|float|The interval to request an update from Automation Hub.|
|`timeout`|""|no|int|If waiting for the project to update this will abort after this amount of seconds.|
|`state`|`present`|no|str|Desired state of the collection repository. Either `present` or `absent`.|

### Standard Project Data Structure
Expand All @@ -78,7 +78,7 @@ ah_collection_repositories:

```yaml
---
- name: Add repository to Automation Hub
- name: Sync repository to Automation Hub
hosts: localhost
connection: local
gather_facts: false
Expand Down
1 change: 0 additions & 1 deletion roles/collection_repository_sync/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ argument_specs:
required: false
description: The path for the Automation Hub API. Usually galaxy or automation-hub unless custom set in AH settings.
ah_validate_certs:
default: true
required: false
description: Whether or not to validate the Automation Hub Server's SSL certificate.
type: str
Expand Down
4 changes: 2 additions & 2 deletions roles/collection_repository_sync/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
# Create AH repository
# Sync AH repository
- name: Sync Automation Hub Collection Remote repository
collection_repository_sync:
name: "{{ __collection_repository_sync_item.name }}"
wait: "{{ __collection_repository_sync_item.wait | default(omit) }}"
interval: "{{ __collection_repository_sync_item.interval | default(1) }}"
timeout: "{{ __collection_repository_sync_item.timeout | default(omit) }}"
ah_host: "{{ ah_host | default(ah_hostname) }}"
ah_host: "{{ ah_host | default(ah_hostname) | default(omit) }}"
ah_username: "{{ ah_username | default(omit) }}"
ah_password: "{{ ah_password | default(omit) }}"
ah_path_prefix: "{{ ah_path_prefix | default(omit) }}"
Expand Down
Loading
Loading