6d23d20f2f
This is preparation for a later version of ansbile-lint, which finds missing names on blocks. This seems a reasonable rule, and the Ansible manual says [1] Names for blocks have been available since Ansible 2.3. We recommend using names in all tasks, within blocks or elsewhere, for better visibility into the tasks being executed when you run the playbook. This simply adds a name tag for blocks that are missing it. This should have no operational change, but allows us to update the linter in a follow-on change. [1] https://docs.ansible.com/ansible/latest/user_guide/playbooks_blocks.html Change-Id: I92ed4616775650aced352bc9088a07e919f1a25f
45 lines
1.6 KiB
YAML
45 lines
1.6 KiB
YAML
- name: Check for webhook id
|
|
fail:
|
|
msg: You must define the webhook id. Get this from the webhook info page on RTD
|
|
when: rtd_webhook_id is not defined
|
|
|
|
- name: Check for an authentication type
|
|
fail:
|
|
msg: Must set either rtd_credentials.username or rtd_credentials.integration_token
|
|
when: (rtd_credentials.username is not defined) and (rtd_credentials.integration_token is not defined)
|
|
|
|
- name: Upload to RTD
|
|
when: rtd_credentials.username is defined
|
|
block:
|
|
- name: Require password
|
|
fail:
|
|
msg: password is required when using rtd_credentials.username
|
|
when: rtd_credentials.password is not defined
|
|
|
|
- name: Trigger readthedocs build webhook via authentication
|
|
uri:
|
|
method: POST
|
|
url: 'https://readthedocs.org/api/v2/webhook/{{ rtd_project_name }}/{{ rtd_webhook_id }}/'
|
|
user: '{{ rtd_credentials.username }}'
|
|
password: '{{ rtd_credentials.password }}'
|
|
# NOTE(ianw): testing it seems the API doesn't respond with
|
|
# 401 so this is required
|
|
force_basic_auth: yes
|
|
# avoid logging any credentials
|
|
no_log: true
|
|
|
|
- name: Trigger RTD docs
|
|
when: rtd_credentials.integration_token is defined and
|
|
rtd_credentials.username is not defined
|
|
block:
|
|
- name: Trigger readthedocs build webhook via token
|
|
uri:
|
|
method: POST
|
|
url: 'https://readthedocs.org/api/v2/webhook/{{ rtd_project_name }}/{{ rtd_webhook_id }}/'
|
|
body_format: form-urlencoded
|
|
body:
|
|
token: '{{ rtd_credentials.integration_token }}'
|
|
follow_redirects: all
|
|
# avoid logging any credentials
|
|
no_log: true
|