Add roles for adding and removing launchpadlib credentials

Change-Id: I5bf80922026d9e68a396effe89bb2d6ea5cbdec0
This commit is contained in:
Monty Taylor 2017-08-28 19:34:16 -05:00
parent 1a36ffd08e
commit 47d1b3a715
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
5 changed files with 55 additions and 0 deletions

View 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

View 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

View 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 =

View File

@ -0,0 +1,7 @@
Remove launchpadlib credentials from a host
**Role Variables**
.. zuul:rolevar:: launchpadlib_credentials
Path to the file containing the credentials.

View File

@ -0,0 +1,7 @@
- name: Remove the launchpadlib credentials
command: shred ~/.launchpadlib/creds
- name: Remove launchpadlib directory
file:
path: ~/.launchpadlib
state: absent