Skip to content

Commit

Permalink
Break cloud-setup into phases (SOC-9077)
Browse files Browse the repository at this point in the history
Currently the cloud-setup.yml, and associated cloud-setup role, is
somewhat monolithic in that it does everything all in one go.

Splitting this up into a set of phases that can be run independently
will make it easier to implement more advanced workflows, e.g. update
or upgrade, where we may want to perform specific phases more than
once with different settings.

Added ardana-nodes.yml top level playbook which dynamically creates
host groups for nodes based upon the ardana_family and ardana_distro
values detected for each node. Including this into a top level playbook
will allow subsequent use of the ardana_suse, ardana_sles, etc host
lists.

Fixed astack-ssh-config generation to correctly add a 'deployer' host
alias if the deployer node is not called 'deployer'; this was dropped
by a previous change.

Switch to using the zypper_repository module instead of running the
raw zypper addrepo and zypper refresh commands, now that there is
support available for setting up repos in the desired way.

Added support for -v flag to bin/ardana-vagrant-ansible.

Switch from using --skip-tags arguments to using an ansible variable
to indicate whether the ardana-init related setup actions should be
skipped as ansible tags can't easily be manilupdated from inside the
ansible code base itself.

Add bin/ardana as a utility that can be used to run arbitrary commands
with the appropriate environment variables set.

Switch to using the 'is' operator to check result status values, such
as success, failed, changed or skipped, in preparation for moving to
newer ansible versions. For example a when condition expression such
as "not (item | skipped)" becomes "item is not skipped". Note that the
files area under the cloud-rhel-deployer is excluded from suc changes
due to that code being uploaded to the deployer and being run under
Ansible 1.9.

Fix various trailing whitespace issues.

Change-Id: I513816674d5b2cfdd3980ee6f16972b2c6954dff
  • Loading branch information
Fergal Mc Carthy committed Jul 2, 2019
1 parent 8cd2c7c commit a1e18d9
Show file tree
Hide file tree
Showing 57 changed files with 916 additions and 704 deletions.
25 changes: 25 additions & 0 deletions ansible/ardana-nodes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# (c) Copyright 2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Playbook to dynamically group nodes by linux distribution family & flavour
# deployment.
---

- hosts: cloud
tasks:
- group_by:
key: ardana_{{ ardana_distro }}
parents:
- ardana_{{ ardana_family }}
25 changes: 25 additions & 0 deletions ansible/cloud-buildservice-repos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# (c) Copyright 2019 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Setup buildservice (IBS and/or OBS) repos for appropriate cloud nodes
---

- import_playbook: ardana-nodes.yml

- hosts: ardana_suse
tasks:
- name: Setup IBS & OBS repos
import_role:
name: suse-buildservice-repos
23 changes: 23 additions & 0 deletions ansible/cloud-deployer-init.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# (c) Copyright 2019 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Install/Update SOC/CLM on the deployer node.
---

- hosts: deployer
tasks:
- name: Install/Update Ardana
import_role:
name: cloud-deployer-init
23 changes: 23 additions & 0 deletions ansible/cloud-deployer-repos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# (c) Copyright 2019 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Setup local repos on the deployer node.
---

- hosts: deployer
tasks:
- name: Setup deployer node repos
import_role:
name: cloud-deployer-repos
21 changes: 21 additions & 0 deletions ansible/cloud-refresh-repos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# (c) Copyright 2019 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
---

- hosts: cloud
tasks:
- name: Refresh all package repos on all cloud nodes
import_role:
name: cloud-refresh-repos
21 changes: 21 additions & 0 deletions ansible/cloud-remote-repos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# (c) Copyright 2019 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
---

- hosts: cloud:!deployer
tasks:
- name: Setup package repos on non-deployer nodes
import_role:
name: cloud-remote-repos
25 changes: 25 additions & 0 deletions ansible/cloud-repos-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# (c) Copyright 2019 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Update the repos on the cloud nodes; should only be used on a cloud
# whose deployer has already been ardana-init'd as it expects that the
# deployer is configured to service the relevant repos via port 79.
---

- import_playbook: cloud-buildservice-repos.yml

- import_playbook: cloud-deployer-repos.yml

- import_playbook: cloud-remote-repos.yml
17 changes: 12 additions & 5 deletions ansible/cloud-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@
# License for the specific language governing permissions and limitations
# under the License.
#
# Main playbook for setting up a SOC/CLM deployment
# Main playbook for setting up a SOC/CLM deployment within a target cloud
---

- import_playbook: cloud-vm-setup.yml

- hosts: cloud
max_fail_percentage: 0
roles:
- cloud-setup
- import_playbook: cloud-buildservice-repos.yml

- import_playbook: cloud-deployer-repos.yml

- import_playbook: cloud-deployer-init.yml

- import_playbook: cloud-remote-repos.yml

- import_playbook: cloud-refresh-repos.yml

- import_playbook: sync-ansible-sources.yml
27 changes: 27 additions & 0 deletions ansible/group_vars/all/ardana
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# (c) Copyright 2019 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Basic Ardana cloud settings
---

ardana_family: "{{ ansible_os_family.split(' ')[0] | lower | replace('open','') }}"
ardana_distro: >-
{%- set _d = 'unknown' -%}
{%- if ardana_family == 'suse' -%}
{%- set _d = 'sles' -%}
{%- elif ardana_family == 'redhat' -%}
{%- set _d = 'rhel' -%}
{%- endif -%}
{{- _d -}}
Loading

0 comments on commit a1e18d9

Please sign in to comment.