Commit Graph

48 Commits

Author SHA1 Message Date
Mark Goddard f63f1f3082 Install openstack.kolla collection
This change adds an Ansible Galaxy requirements file including the
openstack.kolla collection. A new 'kolla-ansible install-deps' command
is provided to install the requirements.

With the new collection in place, this change also switches to using the
baremetal role from the openstack.kolla collection, and removes the
baremetal role from this repository.

Depends-On: https://review.opendev.org/c/openstack/ansible-collection-kolla/+/820168

Change-Id: I9708f57b4bb9d64eb4903c253684fe0d9147bd4a
2022-02-21 14:26:48 +00:00
Maksim Malchuk 75f55d13ad Fix Apparmor libvirt profile removal
The apparmor_parser actually doesn't remove the file or doesn't create
the symlink in '/etc/apparmor.d/disable' itself so the next run of the
baremetal role will fail with the error "Unable to remove "libvirtd".
Even more after reboot, the profile is still active. We need to
disable the profile completly ourselves. This change fixes the
idempotents of the baremetal role.

Closes-Bug: #1960302
Change-Id: I162e417387393e806886b1c9ea8053b89778b4d1
Signed-off-by: Maksim Malchuk <maksim.malchuk@gmail.com>
2022-02-08 13:52:45 +03:00
Radosław Piliszek 9dee2a92d8 Drop enable_host_ntp
As promised for Xena.

Change-Id: Id634426a1961f0b883068e4ed80e7d1633e5708e
2021-10-22 12:25:34 +00:00
wu.chunyang 1f71df1a8b Remove chrony role from kolla
chrony is not supported in Xena cycle, remove it from kolla

Moved tasks from chrony role to chrony-cleanup.yml playbook to avoid a
vestigial chrony role.

Co-Authored-By: Mark Goddard <mark@stackhpc.com>

Change-Id: I5a730d55afb49d517c85aeb9208188c81e2c84cf
2021-09-30 18:56:14 +02:00
Mark Goddard ade5bfa302 Use ansible_facts to reference facts
By default, Ansible injects a variable for every fact, prefixed with
ansible_. This can result in a large number of variables for each host,
which at scale can incur a performance penalty. Ansible provides a
configuration option [0] that can be set to False to prevent this
injection of facts. In this case, facts should be referenced via
ansible_facts.<fact>.

This change updates all references to Ansible facts within Kolla Ansible
from using individual fact variables to using the items in the
ansible_facts dictionary. This allows users to disable fact variable
injection in their Ansible configuration, which may provide some
performance improvement.

This change disables fact variable injection in the ansible
configuration used in CI, to catch any attempts to use the injected
variables.

[0] https://docs.ansible.com/ansible/latest/reference_appendices/config.html#inject-facts-as-vars

Change-Id: I7e9d5c9b8b9164d4aee3abb4e37c8f28d98ff5d1
Partially-Implements: blueprint performance-improvements
2021-06-23 10:38:06 +01:00
Radosław Piliszek 0fa4ee56eb Disable docker's ip-forward when iptables disabled
With the new default since Wallaby, starting Docker makes it
enable forwarding and not filter it at all.
This may pose a security risk and should be mitigated.

Closes-Bug: #1931615
Change-Id: I5129136c066489fdfaa4d93741c22e5010b7e89d
2021-06-10 19:02:33 +00:00
Zuul c61bee3fb4 Merge "baremetal: Don't start Docker after install on Debian/Ubuntu" 2021-05-14 09:40:04 +00:00
Michał Nasiadka bc96179195 baremetal: Don't start Docker after install on Debian/Ubuntu
docker-ce on Debian/Ubuntu gets started just after installation, before
baremetal role configures daemon.json - which results in iptables rules
being implemented - but not removed on docker engine restart.

Closes-Bug: #1923203

Change-Id: Ib1faa092e0b8f0668d1752490a34d0c2165d58d2
2021-05-14 09:00:01 +02:00
Radosław Piliszek 83f3422fbd Deprecate enable_host_ntp
As agreed during IRC meeting. [1]

[1] http://eavesdrop.openstack.org/meetings/kolla/2021/kolla.2021-04-07-15.00.html

Change-Id: Ibffa019e2106784e97f5c482106bb5082f788752
2021-04-27 16:03:22 +00:00
Mark Goddard 5c39810de2 Apply Zun configuration for Docker based on inventory
If docker_configure_for_zun is set to true, then Zun-specific
configuration for Docker is applied to all nodes. It should only be
applied based on the relevant inventory groups. In some cases this can
cause Docker to fail to start. See
https://storyboard.openstack.org/#!/story/2008544 for details.

This change applies the configuration based on the zun-compute and
zun-cni-daemon groups. It also modifies the expression to not assume
that these groups exist in the inventory.

Change-Id: I0141abf0dd83e3a567ea6dcca945f86db129becf
Closes-Bug: #1914378
Story: 2008544
Task: 41645
Co-Authored-By: Buddhika Sanjeewa <bsanjeewa@kln.ac.lk>
2021-04-21 10:42:55 +00:00
Michal Nasiadka 7fa419cfc3 baremetal: Add support for Docker http/https proxy setup
Change-Id: I947c2940518c0f4872acaa977edeaca370dc9a96
2021-03-26 17:51:17 +00:00
Dincer Celik 4053a0afdb [docker] Added a new flag to disable default network
Docker is using 172.17.0.0/16 by default for bridge networking on
docker0, and this might cause routing problems for operator networks.

This change introduces docker_disable_default_network to disable the
bridge networking by putting "bridge: none"[1] to daemon.json

Bridge networking does not work without iptables, so we set the default
for docker_disable_default_network to
docker_disable_default_iptables_rules.

For better defaults, this feature will be enabled by default in
Wallaby.

[1] https://docs.docker.com/engine/reference/commandline/dockerd/

Change-Id: Ic745300b27e50132d80d03787fa4abfada2d0173
Closes-Bug: #1848249
Related-Bug: #1849275
2021-03-11 18:03:28 +00:00
Victor Morales 891ec51dd4 Fix remove libvirt apparmor disabled profile
The bootstrap process tries to removes existing apparmor profiles but
doesn't consider the case where those are disabled. This change fixes
the scenario where the libvirt profile exists but is disabled.

Closes-Bug: 1909874
Change-Id: Ied0f2acc420bd5cf1e092c8aee358cba35bd8d5d
2021-01-08 10:44:00 -08:00
Dincer Celik fc7ce6cabe [docker] Added a new flag to disable default iptables rules
Docker is manipulating iptables rules by default to provide network
isolation, and this might cause problems if the host already has an
iptables-based firewall.

This change introduces docker_disable_default_iptables_rules to
disable the iptables manipulation by putting "iptables: false" [1] to
daemon.json

For better defaults, this feature will be enabled by default in
Victoria.

[1] https://docs.docker.com/network/iptables/

Closes-Bug: #1849275

Change-Id: I165199fc98fb98f227f2a20284e1bab03ef65b5b
2020-07-27 09:09:45 +00:00
Michal Arbet 3d747b7200 Remove chrony package if containerized chrony is enabled
This patch is removing chrony package
from docker host when containerized chrony is enabled.
It is also fixing issue with chrony container running
under Ubuntu docker host as noted below.

+ exec /usr/sbin/chronyd -d -f /etc/chrony/chrony.conf
2020-06-08T08:19:09Z chronyd version 3.4 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +SECHASH +IPV6 -DEBUG)
2020-06-08T08:19:09Z Fatal error : Could not open configuration file /etc/chrony/chrony.conf : Permission denied

Added also removal apparmor profile for ubuntu when
containerized chrony is enabled, as chrony's package
is not removing apparmor profile, and therefore
containerized chrony is not working.

Change-Id: Icf3bbae38b9f5630b69d5c8cf6a8bee11786a836
Closes-Bug: #1882513
2020-06-15 13:06:36 +02:00
Radosław Piliszek 9eed85c8d4 [baremetal] Drop useless reboot task
It is not used for quite a time.
Some ancient Kolla Ansible used to update host kernel.

Change-Id: I9cdc1ec47ad802b4d65a7b6438a335fc14639e05
2020-02-21 13:42:22 +01:00
Mark Goddard 12987ca0fa Fix kolla-bootstrap-servers with docker_storage_driver set
If docker_storage_driver is set in globals.yml, then kolla-ansible
bootstrap-servers is run, it fails like so:

The conditional check 'docker_storage_driver' failed. The error was: error
while evaluating conditional (docker_storage_driver): 'devicemapper' is
undefined

Ansible does not like evaluating strings as conditionals. This change switches
to using the length filter.

Change-Id: Ib95cbdac2a659e7a0d5f113fe48046de3a39dcda
Closes-Bug: #1849691
2019-10-24 16:15:23 +01:00
Marcin Juszkiewicz a5808ad8ba Modernize the way of configuring Docker daemon
Instead of changing Docker daemon command line let's change config
for Docker instead. In /etc/docker/daemon.json file as it should be.

Custom Docker options can be set with 'docker_custom_config' variable.

Old 'docker_custom_option' is still present but should be avoided.

Co-Authored-By: Radosław Piliszek <radoslaw.piliszek@gmail.com>
Change-Id: I1215e04ec15b01c0b43bac8c0e81293f6724f278
2019-09-05 08:19:26 +00:00
Radosław Piliszek c8a57d0c19 Make bootstrap more idempotent
No need to touch the sudoers.d file each time
Creation and mode setting is handled by lineinfile itself

Change-Id: Ia36e21b04d3a08fab3c748f6298f142c1d73ee6d
Signed-off-by: Radosław Piliszek <radoslaw.piliszek@gmail.com>
2019-06-06 12:34:17 +02:00
Mark Goddard a4bb8567da Fix up config file permissions on the host
Several config file permissions are incorrect on the host. In general,
files should be 0660, and directories and executables 0770.

Change-Id: Id276ac1864f280554e98b937f2845bb424d521de
Closes-Bug: #1821579
2019-04-02 17:23:31 +01:00
Mark Goddard 6b0be5c5ba Remove recurse: yes for owner/perms on /etc/kolla
When kolla-ansible bootstrap-servers is run, it executes one of the
following two tasks:

- name: Ensure node_config_directory directory exists for user kolla
  file:
    path: "{{ node_config_directory }}"
    state: directory
    recurse: true
    owner: "{{ kolla_user }}"
    group: "{{ kolla_group }}"
    mode: "0755"
  become: True
  when: create_kolla_user | bool

- name: Ensure node_config_directory directory exists
  file:
    path: "{{ node_config_directory }}"
    state: directory
    recurse: true
    mode: "0755"
  become: True
  when: not create_kolla_user | bool

On the first run, normally node_config_directory (/etc/kolla/) doesn't
exist, so it is created with kolla:kolla ownership and 0755 permissions.

If we then run 'kolla-ansible deploy', config files are created for
containers in this directory, e.g. /etc/kolla/nova-compute/. Permissions
for those files should be set according to 'config_owner_user' and
'config_owner_group'.

If at some point we again run kolla-ansible bootstrap-servers, it will
recursively set the ownership and permissions of all files in /etc/kolla
to kolla:kolla / 0755.

The solution is to change bootstrap-servers to not set the owner and
permissions recursively. It's also arguable that /etc/kolla should be
owned by 'config_owner_user' and 'config_owner_group', rather than
kolla:kolla, although that's a separate issue.

Change-Id: I24668914a9cedc94d5a6cb835648740ce9ce6e39
Closes-Bug: #1821599
2019-03-25 15:39:21 +00:00
Mark Goddard 0cc2daa57d Fix sudoers in bootstrap-servers when user != group
In some cases we may want a configuration in which the kolla user's
primary group name is not the same as their username. Doing this
currently breaks the sudoers configuration, since user entries should
reference a user, or a group prefixed with a '%'.

There does not seem to be a good reason to give root privileges to the
entire group (which sometimes may be a shared group), so let's revert to
giving only the user root privileges.

See kayobe CI test [1] in which a different user and group were
configured, leading to permission denied when using kolla ansible.

[1] http://logs.openstack.org/53/581053/2/check/kayobe-overcloud-centos/a70168e

TrivialFix

Change-Id: I677778ebd0de58df0adfa2a8705f161ec5552283
2018-07-10 12:45:23 +01:00
Mark Goddard 8ec92df8e3 Make sudoers config optional in bootstrap-servers
In some environments it may not be desirable to modify the sudoers
configuration. This change makes this part of bootstrap-servers
optional, based on the create_kolla_user_sudoers variable.

Change-Id: I653403bfc5431741807edef57df58e05e679900b
2018-07-09 19:10:39 +01:00
Mark Goddard 2a69050e37 Append to kolla user groups in bootstrap-servers
This makes the bootstrap-servers command more idempotent, since without
the append argument set the kolla user will be removed from the docker
group before being added to it again in a later task.

TrivialFix

Change-Id: Iab0f6b5e18a103e9140631ee3ebbbb48c490bc24
2018-07-09 19:05:24 +01:00
Mark Goddard 4283dff9b4 Fix ownership of virtualenv in bootstrap-servers
In I86bf5e1df3d6568c4f1ca6f4757f08a3dd22754d, creation of the kolla user
was moved to after package installation to ensure the sudo package is
installed when required. This change does not work when python
dependencies are installed in a virtual environment however - when the
virtualenv variable is set.

This change moves the ownership change of the virtualenv to after the
kolla user has been created. It also uses the kolla_user and kolla_group
variables to set the user and group appropriately.

Change-Id: I320e5d611099ad162945a98d5505a79606da0eba
TrivialFix
2018-07-09 18:58:53 +01:00
fan_guiju 9ff5d5483e Add sudo package for bootstrap-servers
sudo package is required when we use ubuntu base on centos to deploy.

The following tasks belong to the environment check after
installation of environment-related software packages.
So, move to the post-install module.

    Create kolla user
    Add public key to kolla user authorized keys
    Grant kolla user passwordless sudo
    Ensure node_config_directory directory exists for user kolla
    Ensure node_config_directory directory exists

Change-Id: I86bf5e1df3d6568c4f1ca6f4757f08a3dd22754d
Closes-Bug: #1777571
2018-06-25 16:22:11 +08:00
Eduardo Gonzalez ea1a1dee0d Verify YAML syntax in gates
This patchset implements yamllint test to all *.yml
files.

Also fixes syntax errors to make jobs to pass.

Change-Id: I3186adf9835b4d0cada272d156b17d1bc9c2b799
2018-03-26 17:56:22 +02:00
Zuul 83573ca16e Merge "Use kolla_user variable to setting kolla user name" 2018-03-06 13:27:27 +00:00
zhubingbing 83fe717837 Use kolla_user variable to setting kolla user name
Change-Id: I653e16270aab539edcec6d8622f0a1c06d04b492
2018-02-27 15:39:27 +08:00
Zuul dd694b2362 Merge "Fix the warning when reload the docker" 2018-02-26 09:46:17 +00:00
caoyuan 37ef38b6a3 Fix the warning when reload the docker
use systemd module to reload the docker service, rather than
command

Change-Id: I2e3b2299365701a08de4025d6ad34cb492b33fda
Closes-Bug: #1751690
2018-02-26 03:24:24 +00:00
pengdake 4f98f08ffa Update task about selinux set.
1.Fix the invalid value about selinux policy
2.Update description of task about selinux.The permissive mode
need enable selinux.The parameter named "disable_selinux" is not good.
In order to customize selinux modes, we need a new
parameter named "selinux_state".

Closes-Bug: #1749046
Change-Id: I20c084cf2e46cc0de149afbd34c6dcb77a1051f4
2018-02-03 22:30:24 +08:00
Tone.Zhang 3886918c1f Change the docker daemon name in Debian 9 on Arm
Enable docker-ce on AArch64 platform in Debian.
Set the docker daemon name according to the existing of "dockerd" binary.

Closes-Bug: #1734255

Co-authored-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>

Change-Id: Ie0b3bac72b408dccf3fb99912b4fe2d4788705e5
Signed-off-by: Tone.Zhang <tone.zhang@arm.com>
2018-01-09 15:02:40 +08:00
Zuul 68d0a213b0 Merge "Unify global syntax in baremetal role" 2017-10-24 09:17:38 +00:00
Eduardo Gonzalez fa06dcd37b Fix ci gate failure
This patch includes three unrelated fixes.

Make qemu use nova user in centos
Libvirt 3.2.0 (latest version in centos) seems to
have changed behavior of dynamic_ownership.

Pin ansible to <2.4 to make ara work in gates
ARA does not work yet with ansible 2.4, this change
pins to lower version to make gates work.
Revert once ara works with 2.4

Disable selinux for oraclelinux and centos.

Co-Authored-By: wanghongxu <wang19930902@gmail.com>
Co-Authored-By: Jeffrey Zhang <jeffrey.zhang@99cloud.net>
Change-Id: Iac8bec19437192cd198d58f71c6ed0a65a76f820
Closes-bug: #1718541
2017-09-23 09:03:52 +08:00
Eduardo Gonzalez aa0209c9a4 Unify global syntax in baremetal role
Baremetal roles does not keep common sytax used
in rest of the roles, even it baremetal role some
tasks differs in syntax with each others.

Change-Id: Ib04fe123501e2a3e829176953f20719a253999d3
2017-09-19 11:23:20 +02:00
James Benson 8e1940d47a ntpd behind proxy fails
Change-Id: I0447e90f53f9b04315bc4e6618e528351521e05d
Closes-Bug: #1705558
2017-07-23 03:09:00 +00:00
Bertrand Lallau 8b5b3cef4e Clean some Boolean condition checks
* "bool" filter is removed when not required
* 'not' is used instead of '== False' check

Change-Id: I85a5bb9a5ea874ac1c397cbf8de416147d2424c3
2017-07-10 15:00:28 +00:00
Jenkins 8bcbf493f1 Merge "Adds NTP sync process to account for ceph time sync requirements. Removes precheck portion of NTP. Corrects for redhat Fixes typo" 2017-07-07 03:11:13 +00:00
Bertrand Lallau 6c4d100911 Remove Ubuntu Trusty 14.04 related code
Removed code try to install Wily(15.10) kernel in case of Ubuntu
Trusty(14.04).
Last Openstack version supported on Ubuntu 14.04 is Mitaka.
Hence Ubuntu 14.04 related code can be safely remove from Ansible tasks
since Kolla Newton release.

Co-Authored-By: Duong Ha-Quang <duonghq@vn.fujitsu.com>
Change-Id: Ieca7975a69fb0ba8b49cc522f05e4beca1c2f526
2017-06-28 11:09:10 +02:00
James Benson 844ba6d4ba Adds NTP sync process to account for ceph time sync requirements.
Removes precheck portion of NTP.
Corrects for redhat
Fixes typo

Change-Id: Ic8d2cd3c2ba02f9f672db862a74950dc73753f2d
Closes-Bug: #1700121
2017-06-26 16:17:22 -05:00
Michal (inc0) Jastrzebski 2e3b6639fe Fix baremetal role idempotency
When you add new nodes to existing cluster, docker will restart
all anyway and that will break a lot, including mariadb.

Change-Id: Ie46f99a141f99480a87218ead4b76ba65f2edae9
Closes-Bug: #1699335
2017-06-21 11:04:19 -07:00
caoyuan c39e896e7c Update the file format for baremetal
Change-Id: I1e90b0aeebaa0db0b91370eccfc0b707d9668752
2017-03-02 05:46:18 +00:00
zhuzeyu 49c0ca3a9c Optimize the code
make bool filter more consistence between all roles.

TrivialFix

Change-Id: Icd51749039b1448e09a4713da093b16f965f9ed8
2016-12-07 15:29:07 +08:00
caoyuan df54e88132 Update the task's name
TrivialFix

Change-Id: I2cc1441a5fcf9c09db01d17c840bb784f4db1c0e
2016-10-27 16:17:42 +00:00
Mauricio Lima 18785f416c Remove unneeded blank lines
TrivialFix

Change-Id: I778d0a55adf1302c7a6f0702fec3a381d851f3df
2016-10-06 12:42:27 -03:00
Christian Berendt 419e560d2b Check if libvirtd apparmor profiles exists before removal
TrivialFix

Change-Id: Ifa6432f24d4eaa354b977b71a6dbcd5f5080e1b0
2016-09-12 19:13:29 +02:00
Sean Mooney 3e8f9986d1 add baremetal role to install kolla deps.
Change-Id: Ie70db1b18a73528b1194e4fbcf53d09fed20f4a0
Implements: blueprint kolla-host
2016-08-10 16:03:08 +00:00