Add roles for adding and removing launchpadlib credentials
Change-Id: I5bf80922026d9e68a396effe89bb2d6ea5cbdec0
This commit is contained in:
parent
1a36ffd08e
commit
47d1b3a715
20
roles/add-launchpad-credentials/README.rst
Normal file
20
roles/add-launchpad-credentials/README.rst
Normal file
@ -0,0 +1,20 @@
|
||||
Add launchpadlib credentials and launchpadlib to a host
|
||||
|
||||
**Role Variables**
|
||||
|
||||
.. zuul:rolevar:: lp_creds
|
||||
|
||||
Complex argument which contains the information needed to log in
|
||||
to Launchpad. It is expected that this argument comes from a `Secret`.
|
||||
|
||||
.. zuul:rolevar:: access_token
|
||||
|
||||
Launchpad access token
|
||||
|
||||
.. zuul:rolevar:: access_secret
|
||||
|
||||
Launchpad access secret
|
||||
|
||||
.. zuul:rolevar:: consumer_key
|
||||
|
||||
Launchpad consumer key
|
16
roles/add-launchpad-credentials/tasks/main.yaml
Normal file
16
roles/add-launchpad-credentials/tasks/main.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
- name: Ensure launchpadlib directory
|
||||
file:
|
||||
path: ~/.launchpadlib
|
||||
state: directory
|
||||
|
||||
- name: Write credentials
|
||||
template:
|
||||
path: ~/.launchpadlib/creds
|
||||
mode: 0600
|
||||
src: creds.j2
|
||||
|
||||
- name: Install launchpadlib
|
||||
package:
|
||||
name: python-launchpadlib
|
||||
state: present
|
||||
become: yes
|
5
roles/add-launchpad-credentials/templates/creds.j2
Normal file
5
roles/add-launchpad-credentials/templates/creds.j2
Normal file
@ -0,0 +1,5 @@
|
||||
[1]
|
||||
access_token = {{ lp_creds.access_token }}
|
||||
access_secret = {{ lp_creds.access_secret }}
|
||||
consumer_key = {{ lp_creds.consumer_key }}
|
||||
consumer_secret =
|
7
roles/remove-launchpad-credentials/README.rst
Normal file
7
roles/remove-launchpad-credentials/README.rst
Normal file
@ -0,0 +1,7 @@
|
||||
Remove launchpadlib credentials from a host
|
||||
|
||||
**Role Variables**
|
||||
|
||||
.. zuul:rolevar:: launchpadlib_credentials
|
||||
|
||||
Path to the file containing the credentials.
|
7
roles/remove-launchpad-credentials/tasks/main.yaml
Normal file
7
roles/remove-launchpad-credentials/tasks/main.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
- name: Remove the launchpadlib credentials
|
||||
command: shred ~/.launchpadlib/creds
|
||||
|
||||
- name: Remove launchpadlib directory
|
||||
file:
|
||||
path: ~/.launchpadlib
|
||||
state: absent
|
Loading…
Reference in New Issue
Block a user