Commit Graph

28 Commits

Author SHA1 Message Date
Zuul fa10b18a4f Merge "Add region to task output" 2018-11-07 00:29:55 +00:00
Ian Wienand 01858ea602 Add region to task output
It's also very helpful to have the region in the task name when you
have multiple regions for a cloud.

Change-Id: I85c0769bb2332a91aa759fb90223ec812dc3e77d
2018-11-07 11:10:56 +11:00
Zuul cc2d4c8b62 Merge "Add the cloud name to more task details" 2018-11-06 23:41:23 +00:00
Ian Wienand 7dc9777628 Add the cloud name to more task details
Add the cloud name to make it easier to debug what's going on in each
teask when you have this running on many clouds.

Change-Id: Ife331f8048d18e8ecb8743d1cdedadbdedffa2a2
2018-11-07 10:09:15 +11:00
Clark Boylan 472065fb05 Don't use deprecated when jinja2 syntax
Under current ansible 2.6 we get the following warning type when running
the cloud launcher:

  [WARNING]: when statements should not include jinja2 templating delimiters such as {{ }} or {% %}. Found: {{ 'security_groups_rules' in profiles|selectattr('name', 'equalto', item_profile)|list|first }}

Fix this by removing the outer {{ }} from the when statement strings.

Change-Id: I71363f628a8c03784f2ea3fc7082246a6f092f36
2018-09-06 13:53:09 -07:00
Ricardo Carrillo Cruz 126a547f04 Add quotas support for the cloud launcher
While we get a proper os_quota module in Ansible, let's just workaround
it with good old openstack client.

Change-Id: I4036359b09f5bb534143dcb18abe57586b6c8740
2016-10-14 21:01:39 +00:00
Ricardo Carrillo Cruz 702c099e05 Add user roles support for cloud launcher
Change-Id: I3d12403a79b0551ff993816b24829f9bf7424ad4
2016-09-29 23:40:34 +02:00
Ricardo Carrillo Cruz 9a4ad9406f Add support for keystone roles
Change-Id: I2df8503bb713827f0f04691c2f259dc9541c9c83
2016-09-28 16:29:08 +02:00
Ricardo Carrillo Cruz fa645b641e Provide a human-readable output on role executions
The output of Ansible is hard to read, so adding tasks names to
all tasks for better debugging.

Change-Id: I6e4dfa0fbcefca4521d0650d6dd46bcf753b38f8
2016-09-07 16:02:22 +02:00
Ricardo Carrillo Cruz 1b56aed513 Ability to run the launcher against a particular cloud
When we feed a resources.yaml file containing the 'clouds' dict
containing the definitions, the role will happily process all of them.
This is good, but it would also be nice to specify on the command line
that we only want to run the launcher against a specific cloud.
With this change, we can just pass -e "cloud=foocloud" to ansible-playbook
and the launcher will just process the resources for cloud 'foocloud'.

Change-Id: I37cddfbbbb83203ed62434dccac60511f726c6a4
2016-09-02 12:18:11 +00:00
Ricardo Carrillo Cruz fe8af280a4 Add ability to download an image from the Internet to upload it to Glance
Unfortunately, it seems Glance v2 does not have the capability to upload
an image by referencing a URL, it has to be a local file.
Adding logic to the role and flags should the user want to pull an image
to the Ansible control machine prior to the usual upload.

Change-Id: I2e2886287a045dab89fe712e39b42c2383d6aec6
2016-09-01 23:35:40 +02:00
Paul Belanger 11483dafd4
Initial support for regions
This is the first attempt at adding support for regions.

Change-Id: If9f7b8b72cc03678e6bd4e188f9dbeaca56b82a1
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2016-08-25 13:46:33 -04:00
Ricardo Carrillo Cruz 205f4d31de Add support for clustered servers
Certain services are expected to be served by more than one server,
think of git mirrors, zuul workers etc.
While we could define all of them with numbered pattern manually
in the resources.yaml file, this gets unwieldy and boring
if the count is large, repeating on and on the same
server stanzas with just <service_name><$NODE_COUNT>.
This change allows to put a 'node_count' attribute to the server
resource. With it, the role will create as many servers as
'node_count' by numbering the servers as <server_name><$NODE_COUNT>.
e.g.

servers:
  - name: logstash-worker.openstack.org
    image: ubuntu-trusty
    flavor: d1
    node_count: 2

That would make the role to create two server instances named
'logstash-worker01.openstack.org' and 'logstash-worker02.openstack.org'

Change-Id: I220a2786efe56187f60f1eed2f32e661e6d3ed3f
2016-07-20 14:49:03 +02:00
Ricardo Carrillo Cruz 601e29432d Add created servers to cl_servers_just_created group
This hook allows to run things afterwards  on the servers
created by the role on the play context.

Change-Id: If9dc3235cf785dbc04a0c797991bce3a8d987cd0
2016-07-20 12:21:22 +02:00
Ricardo Carrillo Cruz 0f933d768a Fix creation of servers with on-the-fly keypairs
On 301ae3faee refactor, I overlooked
the creation of servers with the generate_keypair flag enabled.
This change adds it back.

Change-Id: I891eba482db38e0b4f97222e37c9bd2e214571d1
2016-07-19 17:24:18 +00:00
Ricardo Carrillo Cruz 301ae3faee Refactor the per-cloud and per-profile code
Rather than copy-pasting around same tasks but changing slightly
the way we loop them when it's a per-profile or a per-cloud resource,
refactor the code a bit so both mechanisms call the same task.
e.g. the per-profile projects and per-cloud projects will call in the
end create_project, the only thing it varies is the loop prior to getting
the individual project items.

Change-Id: Ida2aebadafd4d60d11fa18aa2208dad235badd4c
2016-07-19 00:12:44 +02:00
Ricardo Carrillo Cruz adc37970ab Add ability to generate keypair on-the-fly
This change adds a flag 'generate_keypair' that makes the
role to generate an ssh keypair, create an OpenStack keypair with
it and all the servers of the play will have that key baked in.
The folder, key type and key length are also configurable.

Change-Id: Iccbec24e9834c1fa03da8add94e069f622024537
2016-06-22 13:14:03 +00:00
Jenkins abcd121c0b Merge "Do not loop profile resources on cloud without profiles defined" 2016-05-27 10:36:35 +00:00
Jenkins 85010a4250 Merge "Remove .1 reference from loop" 2016-05-27 10:33:21 +00:00
Ricardo Carrillo Cruz 5938a2a4be Remove .1 reference from loop
This is not a subitems loop, but a plain with_items loop

Change-Id: Ib83a0badbf0fca82c6c31c4296b50fe463d8a145
2016-05-27 10:30:53 +00:00
Ricardo Carrillo Cruz 78849ac851 Do not loop profile resources on cloud without profiles defined
Without this, the role fails if a cloud has no profiles defined
due to a missing key.

Change-Id: I364d427ebce75677abffe955d08b706b94ff19ac
2016-05-27 10:25:23 +00:00
Ricardo Carrillo Cruz f3eb4acb90 Fix per-cloud routers loop
It was referencing subnets, probably a previous copy-pasta.

Change-Id: I6db9d84fbec89243e9c0bdc3f4d347b4e3acfe45
2016-05-27 10:22:23 +00:00
ricardo.carrillo.cruz@gmail.com bd2003ce3a Set both the hostname and ip address for servers created
As the set_hostnames playbook relies on inventory having
hostnames, we put both, so we can ssh to servers via
ansible_ssh_host and we can also infer info from inventory_hostname
to set the hostnames.

Change-Id: I10e153f11f85828c98cf728609a6ca18ae1a8d2a
2016-05-25 16:14:59 +00:00
Ricardo Carrillo Cruz 047e9ab687 Add created servers to dynamic group
This provides a hook for subsequent plays to do things
on servers created by the role.

Change-Id: I1870c1974abece12dc13b0d6c259d930e1e67dd0
2016-05-24 21:39:46 +00:00
Ricardo Carrillo Cruz bacf4d2788 Make resources.yml profiles optional
A user is required to put clouds, but it may or may not use
a profile to define resources.
Therefore, make it optional.

Change-Id: I227dbf04b8e12571bbab58df7fe51d3a2e0d44df
2016-05-16 17:02:49 +00:00
Ricardo Carrillo Cruz 691970f923 Use new loop_control/loop_var constructs from Ansible devel
Ansible now allows you to name the loop var, fixing nested
with_items include issue:

https://github.com/ansible/ansible/issues/14146#

Switching to it for making role future proof.
2016-04-25 02:55:50 +00:00
Ricardo Carrillo Cruz 084231bfc3 Fix several bogus item.present lines
This was a copy-pasta from one task to others.
The right attribute is state, thus item.state.
2016-04-04 16:07:36 +00:00
Ricardo Carrillo Cruz 302bc53977 Initial commit 2016-03-30 13:08:49 +00:00