Commit Graph

503 Commits (5a410263470932f2f1a22572e0f2c42939591402)

Author SHA1 Message Date
Sébastien Han 73c4846744 mon: use ceph_crush module in the playbook
Instead of creating the CRUSH hierarchy with Ansible tasks using the
command module we now rely on the ceph_crush module.

Signed-off-by: Sébastien Han <seb@redhat.com>
2018-03-06 15:24:31 +00:00
Greg Charot 78c1f1938f mons: Current crush_rule playbook does not work if there is no default rule defined (default: true).
One could want to add new crush rules while keeping his current default rule.
Fixed it so that it works with all rules defined as "default: false". If multiple rules are defined as default (should not be) then the last rule listed in "crush_rules" is taken as default.
2018-03-06 15:24:31 +00:00
Greg Charot 77f9c1df10 no reason the ceph-ansible ansible default provided crush_rule_hdd rule should be set as rack root + default ruleset 2018-03-06 15:24:31 +00:00
Greg Charot 50afc3fbf3 We don't want to automatically move the rbd pool to the new default crush rule. This operation shall be performed by the cluster operator. 2018-03-06 15:24:31 +00:00
jtudelag c3267b77b7 Makes use of docker_exec_cmd in ceph-mon role.
Keeps consistency inside the role and among roles.
Makes the code more readable.
2018-03-05 12:48:35 +00:00
Giulio Fidente a83e1aeea3 Make rule_name optional when defining items in openstack_pools
Previously it was necessary to provide a value (eventually an
empty string) for the "rule_name" key for each item in
openstack_pools. This change makes that optional and defaults to
empty string when not given.
2018-02-23 15:11:53 +01:00
Andy McCrae b4dbc862d6 Set application for OpenStack pools
Since Luminous we need to set the application tag for each pool,
otherwise a CEPH_WARNING is generated when the pools are in use.

We should assign the OpenStack pools to their default which would be
"rbd". When updating to Luminous this would happen automatically to the
vms, images, backups and volumes pools, but for new deploys this is not
the case.
2018-02-09 17:15:55 +01:00
Giulio Fidente bdcc52b96d Check for docker sockets named after both _hostname or _fqdn
While hostname -f will always return an hostname including its
domain part and -s without the domain part, the behavior when
no arguments are given can include or not include the domain part
depending on how the system is configured; the socket name might
not match the instance name then.
2018-02-06 14:16:54 +01:00
Greg Charot a6d1922a2e mon: Fixed crush_rule_config for containerised deployment.
Was called too early, container was not yet started so the commands failed.
Moved the section after include docker/main.yml

Signed-off-by: Greg Charot <gcharot@redhat.com>
2018-02-06 05:12:59 +01:00
Guillaume Abrioux deaf273b25 syntax: change local_action syntax
Use a nicer syntax for `local_action` tasks.
We used to have oneliner like this:
```
local_action: wait_for port=22 host={{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }} state=started delay=10 timeout=500 }}
```

The usual syntax:
```
    local_action:
      module: wait_for
      port: 22
      host: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}"
      state: started
      delay: 10
      timeout: 500
```
is nicer and kind of way to keep consistency regarding the whole
playbook.

This also fix a potential issue about missing quotation :

```
Traceback (most recent call last):
  File "/tmp/ansible_wQtWsi/ansible_module_command.py", line 213, in <module>
    main()
  File "/tmp/ansible_wQtWsi/ansible_module_command.py", line 185, in main
    rc, out, err = module.run_command(args, executable=executable, use_unsafe_shell=shell, encoding=None, data=stdin)
  File "/tmp/ansible_wQtWsi/ansible_modlib.zip/ansible/module_utils/basic.py", line 2710, in run_command
  File "/usr/lib64/python2.7/shlex.py", line 279, in split
    return list(lex)                                                                                                                                                                                                                                                                                                            File "/usr/lib64/python2.7/shlex.py", line 269, in next
    token = self.get_token()
  File "/usr/lib64/python2.7/shlex.py", line 96, in get_token
    raw = self.read_token()
  File "/usr/lib64/python2.7/shlex.py", line 172, in read_token
    raise ValueError, "No closing quotation"
ValueError: No closing quotation
```

writing `local_action: shell echo {{ fsid }} | tee {{ fetch_directory }}/ceph_cluster_uuid.conf`
can cause trouble because it's complaining with missing quotes, this fix solves this issue.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1510555

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2018-01-31 10:45:34 +01:00
Sébastien Han 6f9dd26caa config: remove any spaces in public_network or cluster_network
With two public networks configured - we found that with
"NETWORK_ADDR_1, NETWORK_ADDR_2" install process consistently became
broken, trying to find docker registry on second network, and not
finding mon container.

but without spaces
"NETWORK_ADDR_1,NETWORK_ADDR_2" install succeeds
so, containerized install is more peculiar with formatting of this line

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1534003
Signed-off-by: Sébastien Han <seb@redhat.com>
2018-01-30 17:47:15 +01:00
Eduard Egorov 7d7080df6c crush: create rack type buckets and build crush tree according to {{ osd_crush_location }}.
Currently, we can define crush location for each host but only crush roots and crush rules are created. This commit automates other routines for a complete solution:
  1) Creates rack type crush buckets defined in {{ ceph_crush_rack }} of each osd host. If it's not defined by user then a rack named 'default_rack_{{ ceph_crush_root  }}' would be added and used in next steps.
  2) Move rack type crush buckets defined in {{ ceph_crush_rack }} into crush roots defined in {{ ceph_crush_root }} of each osd host.
  3) Move hosts defined in {{ ceph_crush_rack }} into crush roots defined in {{ ceph_crush_root }} of each osd host.

Signed-off-by: Eduard Egorov <eduard.egorov@icl-services.com>
2018-01-11 17:42:18 +01:00
Guillaume Abrioux 70401f955b container: trigger handlers on systemd file change
When a systemd unit file is changed we should trigger handlers to
restart the services.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2018-01-10 16:46:42 +01:00
Sébastien Han f0787e64da mon: use crush rules for non-container too
There is no reasons why we can't use crush rules when deploying
containers. So moving the inlcude in the main.yml so it can be called.

Signed-off-by: Sébastien Han <seb@redhat.com>
2018-01-10 15:21:36 +01:00
Sébastien Han 0b55abe3d0 mon: always run ceph-create-keys
ceph-create-keys is idempotent so it's not an issue to run it each time
we play ansible. This also fix issues where the 'creates' arg skips the
task and no keys get generated on newer version, e.g during an upgrade.

Closes: https://github.com/ceph/ceph-ansible/issues/2228
Signed-off-by: Sébastien Han <seb@redhat.com>
2017-12-21 13:50:01 +01:00
Christian Berendt 50a848dc40 Rename fact docker_version to ceph_docker_version
The name docker_version is very generic and is also used by other
roles. As a result, there may be name conflicts. To avoid this a
ceph_ prefix should be used for this fact. Since it is an internal
fact renaming is not a problem.
2017-12-15 20:12:21 +01:00
Major Hayden 5676fa23b1 Convert interface names to underscores for facts
If a deployer uses an interface name with a dash/hyphen in it, such
as 'br-storage' for the monitor_interface group_var, the ceph.conf.j2
template fails to find the right facts. It looks for
'ansible_br-storage' but only 'ansible_br_storage' exists.

This patch converts the interface name to underscores when the
template does the fact lookup.
2017-12-12 09:03:40 +01:00
John Fulton ffae294288 Set tighter permissions on keyrings when containerized
During a containerized deployment, set the permissions
of ceph.client.admin.keyring and other keyrings to
chmod 600 and chown it to ceph.
2017-12-06 19:22:28 -05:00
wintamute ebe0e60235 Openstack: replaced hardcoded pool names with variables for openstack (nova) user
(cherry picked from commit 2bf48f1)
2017-11-28 09:06:51 +01:00
John Fulton d73f751b63 Make openstack_keys param support no acls list
A recent change [1] required that the openstack_keys
param always containe an acls list. However, it's
possible it might not contain that list. Thus, this
param sets a default for that list to be empty if it
is not in the structure as defined by the user.

[1] d65cbaa539
2017-11-16 11:29:59 -05:00
Sébastien Han cc264d6ba6
Merge pull request #2151 from hwoarang/add-opensuse
Add openSUSE Leap 42.3 support
2017-11-16 14:35:28 +01:00
John Fulton d65cbaa539 Set permissions and ACLs of OpenStack keys on all ceph-mons
If ceph-ansible deploys a Ceph cluster with "openstack_config: true"
and sets the openstack_keys map to have certain ACLs or permissions,
the requested ACLs or permissions are only set on one of the monitor
nodes [2] when they should be set on all of them.

This patch solves [3] the above issue by having the chmod and setfacl
tasks iterate the list of mon nodes (including the mon node that the
task was delegated to) to apply the chmod of setfacl to the keys in
openstack_keys.

[1]
```
openstack_keys:
  - { name: client.openstack, key: "$(ceph-authtool --gen-print-key)", mon_cap: "allow r", osd_cap: "allow class-read object_prefix rbd_children, allow rwx pool=images, allow rwx pool=vms, allow rwx pool=volumes, allow rwx pool=backups", mode: "0600", acls: ["u:nova:r--", "u:cinder:r--", "u:glance:r--", "u:gnocchi:r--"] }
```
[2]
```
$ ansible mons -m shell -b -a "ls -l /etc/ceph/ceph.client.openstack.keyring ; getfacl /etc/ceph/ceph.client.openstack.keyring"
192.168.1.26 | SUCCESS | rc=0 >>
-rw-r-----+ 1 root root 253 Nov  3 20:30 /etc/ceph/ceph.client.openstack.keyring
user::rw-
user:glance:r--
user:nova:r--
user:cinder:r--
user:gnocchi:r--
group::---
mask::r--
other::---getfacl: Removing leading '/' from absolute path names

192.168.1.29 | SUCCESS | rc=0 >>
-rw-r--r--. 1 root root 253 Nov  3 20:30 /etc/ceph/ceph.client.openstack.keyring
user::rw-
group::r--
other::r--getfacl: Removing leading '/' from absolute path names

192.168.1.23 | SUCCESS | rc=0 >>
-rw-r--r--. 1 root root 253 Nov  3 20:30 /etc/ceph/ceph.client.openstack.keyring
user::rw-
group::r--
other::r--getfacl: Removing leading '/' from absolute path names

$
```
[3]
```
(undercloud) [stack@hci-director ceph-ansible]$ ansible mons -m shell -b -a "ls -l /etc/ceph/ceph.client.openstack.keyring ; getfacl /etc/ceph/ceph.client.openstack.keyring"
192.168.1.25 | SUCCESS | rc=0 >>
-rw-r-----+ 1 root root 253 Nov 14 01:12 /etc/ceph/ceph.client.openstack.keyring
user::rw-
user:glance:r--
user:nova:r--
user:cinder:r--
user:gnocchi:r--
group::---
mask::r--
other::---getfacl: Removing leading '/' from absolute path names

192.168.1.29 | SUCCESS | rc=0 >>
-rw-r-----+ 1 root root 253 Nov 14 01:12 /etc/ceph/ceph.client.openstack.keyring
user::rw-
user:glance:r--
user:nova:r--
user:cinder:r--
user:gnocchi:r--
group::---
mask::r--
other::---getfacl: Removing leading '/' from absolute path names

192.168.1.27 | SUCCESS | rc=0 >>
-rw-r-----+ 1 root root 253 Nov 14 01:12 /etc/ceph/ceph.client.openstack.keyring
user::rw-
user:glance:r--
user:nova:r--
user:cinder:r--
user:gnocchi:r--
group::---
mask::r--
other::---getfacl: Removing leading '/' from absolute path names

(undercloud) [stack@hci-director ceph-ansible]$
```
2017-11-15 10:09:24 -05:00
Markos Chandras 34a40adcf7 ceph-mon: Add support for openSUSE Leap distributions
Add support for openSUSE Leap distributions.

Signed-off-by: Markos Chandras <mchandras@suse.de>
2017-11-14 10:51:23 +00:00
Guillaume Abrioux 80d32decd3 config: fix config generation
The path to the fact is not correct.
In any case, we will retrieve the IP address in hostvars, the variable
is the way we get the interface name according where it has been set
(eg.: inventory host file vs. group_vars/)

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1510906

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-11-09 08:50:57 +01:00
Sébastien Han ab7eb79212 config: fix monitor_interface when not passed in the inventory file
Setting monitor_interface in group_vars/all.yml makes the
hostvars[host]['monitor_interface'] non-existing.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1507922
Signed-off-by: Sébastien Han <seb@redhat.com>
2017-11-03 09:25:02 +01:00
Sébastien Han 5a10b048b0 Merge pull request #2105 from major/really-fix-always-run
Really fix always run
2017-10-27 09:33:47 +02:00
John Fulton ae156e9f34 Make acls and mode parameters of opentack_keys optional
Only chmod or setfacl the requested keyring(s) in the
opentack_keys data structure when the mode or acls keys
of that data structure exist.

User may specify four permission combinations for the
keyring file(s): 1. only set ACL, 2. only set mode,
3. set neither mode nor ACL, 4. set mode and then ACL.

Fixes: #2092
2017-10-26 12:45:17 +00:00
Major Hayden f73232caa4
Use check_mode instead of always_run
This patch changes the `always_run: yes` task option to
`check_mode: no` to avoid Ansible warnings.
2017-10-25 09:53:34 -05:00
Major Hayden c2b5118c1b
Revert "Avoid deprecated always_run"
This reverts commit 620fb37dd4.
2017-10-25 09:48:09 -05:00
Sébastien Han 4413511b66 all: backward compatibility between stable-2.2 and 3.0
stable-3.0 brought numerous changes in ceph-ansible variables, this PR
aims to maintain backward compatibility for someone running stable-2.2
upgrading to stable-3.0 but keeps its groups_vars untouched.
We will then determine the right options to make sure the upgrade works
but we are expecting that new variables should be used.

We will drop this in a near future, maybe 3.1 or 3.2.

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-10-20 11:54:10 +02:00
Christian Berendt 4c380c9ef8 Cleanup readme files in roles directories
The contents of the README files are no longer up to date.
Documentation for all roles is located below the docs directory.
2017-10-17 11:22:06 +02:00
Christian Berendt cf901f0171 In docker start scripts replace \u00a0 with \u0020
This will solve the following issue when starting docker containers on ubuntu:

invalid argument "1\u00a0" for --cpus=1 : failed to parse 1  as a rational number

Closes-bug: #2056
2017-10-16 15:16:48 +02:00
Sébastien Han 71d819620c mds: fix fs pool creation
1. add the variables to docker_collocation
2. trigger the check when a MDS is part of the inventory file, not when
we run on an MDS...

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-10-13 16:03:04 +02:00
Major Hayden c01851325e
Remove jinja2 delimiters from `when` keys
This patch changes the `when:` keys so that they have no jinja2
delimiters. This avoids Ansible warnings which could turn into
errors in a future Ansible release.
2017-10-12 11:27:42 -05:00
Guillaume Abrioux 17623a2157 Merge pull request #2036 from ceph/cephfs-pool
mds: precisely define cephfs pool
2017-10-12 17:47:10 +02:00
Sébastien Han b49f9bda21 mds: precisely define cephfs pool
We now have a variable called ceph_pools that is mandatory when
deploying a MDS.
It's a dictionnary that contains a pool name and a PG count. PG count is
mandatory and must be set, the playbook will fail otherwise.

Closes: https://github.com/ceph/ceph-ansible/issues/2017
Signed-off-by: Sébastien Han <seb@redhat.com>
2017-10-12 15:56:04 +02:00
Major Hayden 620fb37dd4
Avoid deprecated always_run
The `always_run` key is deprecated and being removed in Ansible 2.4.
Using it causes a warning to be displayed:

    [DEPRECATION WARNING]: always_run is deprecated.

This patch changes all instances of `always_run` to use the `always`
tag, which causes the task to run each time the playbook runs.
2017-10-12 08:29:44 -05:00
Sébastien Han 164c77acd1 Merge pull request #1995 from ceph/remove-rbd-check
jewel: remove rbd check
2017-10-05 15:31:48 +02:00
Sébastien Han b545080d71 Merge pull request #1988 from ceph/fix_keyrings
docker: fix keyrings copied on all nodes
2017-10-05 14:30:09 +02:00
Sébastien Han bbf6bebe32 jewel: remove rbd check
The value of doing this is fairly low compare to the added value.
So we remove these tasks, if rbd pool on Jewel doesn't have the right PG
value you can always increase it.

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-10-05 14:21:37 +02:00
Jan Provaznik 43e57abfd8 Evaluate cephfs pool variables
Otherwise pools with names 'cephfs_data' and 'cephfs_metadata'
are created.
2017-10-05 10:00:20 +02:00
Guillaume Abrioux 70e2787fe2 docker: fix keyrings copied on all nodes
All keyring are getting copied to all nodes.
This commit fixes a leftover from a previous code refactor.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1498583

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-10-05 09:23:22 +02:00
Guillaume Abrioux 2c4258a0fd Refact code for set_osd_pool_default_*
This commit refacts the code regarding all `set_osd_pool_default_*`
related tasks by avoiding usage of useless `set_fact` to determine
whether a key is present in `ceph_conf_overrides`.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-10-04 15:40:10 +02:00
Al Lau 6aca67bc9c Only perform actions on the rbd pool after it has been created
The rbd pool is the default pool that gets created during ceph cluster
initializaiton.  If we act on the rbd related operations too early, the
rbd pool does not exist yet.  Move the call to perform rbd operations
to a later stage after other pools have been created.

The rbd_pool.yml playbook has all the operations related to the rbd pool.

Replace the always_run (deprecated) directive with check_mode.

Most of the ceph related tasks only need to run once.  The run_once directive
executes the task on the first host.

The ceph sub-command to delete a pool is delete (not rm).

The changes submitted here were tested with this ceph version.
ceph version 0.94.9-9.el7cp (b83334e01379f267fb2f9ce729d74a0a8fa1e92c)

This upload includes these changes:
  - Use the fail module (instead of assert).
  - From luminous release, the rbd pool is no longer created by default.
    Delete the code to create the rbd pool for luminous release
  - Conform the .yml files to use the suggested syntax.

The commands are executed on the mcp nodes and I think shell ansible module
is the right one to use.  The command module is used to execute commands on
remote nodes.  I can make the change to use command module if that is
prefrerred.
2017-10-04 15:40:10 +02:00
Guillaume Abrioux 784cc73da0 set docker_exec_cmd fact early in each role
This is to ensure `docker_exec_cmd` fact is set with the correct value
in case of daemons collocation

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-10-04 11:31:09 +02:00
Guillaume Abrioux 62770cd7de refact MDS role
This commits refacts the role ceph-mds

The goal here is to create cephfs in `ceph-mon` for both containerized
and non-containerized cases so we don't need the admin keyring on mds
nodes anymore.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1488999

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-10-02 09:12:31 +02:00
Guillaume Abrioux 466f6f35b7 Use systemd module instead of service.
Using systemd module allows us to do in one task what we did in three
tasks:

- enable unit file,
- issue a `daemon-reload`,
- start the service

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-09-29 14:54:00 +02:00
Guillaume Abrioux 913ad53709 docker: add condition to run selinux tasks only on rhel os family
This fixes the error :

```
The conditional check 'sestatus.stdout != 'Disabled'' failed.
```

that occurs when running on non rhel based system since the
`sestatus` fact is registered only on rhel based distribution.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-09-29 02:35:07 +02:00
Douglas Fuller 9bcbf748a3 mon/ceph_keys: Add timeout flag to ceph-create-keys
Specify the timeout flag to ceph-create-keys, which causes it to time out
if a monitor quorum isn't achieved. This overrides the default timeout
of 10 minutes, causing ceph-ansible to fail faster in the event of cluster
network issues.

Signed-off-by: Douglas Fuller <dfuller@redhat.com>
2017-09-27 18:05:59 -04:00
Guillaume Abrioux be757122f1 config: fix path to set `interface` in ceph.conf
need to use `hostvars[host]['XXX']` to retrieve the monitor
interface and/or radosgw interface.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1493920

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-09-23 14:18:28 +02:00
Guillaume Abrioux 62cd0bae54 rbd: fix missing keyring on nodes
the rbd key was not pushed on rbd nodes because its keyring path was not
added in `ceph_config_keys`.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-09-21 09:56:37 +02:00
Sébastien Han cb05172605 docker: we don't need to copy the ceph.conf on all the nodes
We generate the ceph.conf on all the nodes through the
ceph-docker-common so there is no need to push it to the Ansible file.

Also this is breaking the ceph.conf template generation since we only
generate sections based on the host the ansible task is running on.

For example, what's typically happening, we bootstrap the monitor, we
get a ceph.conf generated for a mon only, we go on an osd, we generate
the ceph.conf with osd section (done by ceph-docker-common) but this
gets overwritten by the copy_config task of the ceph-osd role.

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-09-20 16:33:29 +02:00
Sébastien Han d100b4e596 name includes and set_fact for clarity
When Ansible is not run with verbose options it's difficult to see which
include and/or set_fact does what. So adding a name for each clarifies.

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-09-18 23:39:46 +02:00
Sébastien Han fb02b1d9d3 mon: create the mgr key for release >= luminous
This fixes RHCS builds. We know which Ceph version we are running on.

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-09-14 11:06:44 -06:00
Sébastien Han 2a1b8a1997 Merge pull request #1884 from ceph/mon-container-ip
mon: add support for monitor_address block for containers
2017-09-13 01:46:18 +02:00
Sébastien Han 02ba65dbbe mon: add support for monitor_address block for containers
Signed-off-by: Sébastien Han <seb@redhat.com>
2017-09-12 16:28:08 -06:00
Guillaume Abrioux 0f506f4f0a Docker: split the task 'copy ceph configs&keys'
All keys are copied to all nodes.
This commit split that task in each roles so keys are copied to their
respective nodes.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1488999

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-09-11 21:14:13 +02:00
Sébastien Han 2ea7f287fa docker: simplify variable declaration
Less configuration for the user, the container inherit from the global
variables. No more container specific variables.

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-09-09 01:22:06 +02:00
Sébastien Han cf88c136f5 Merge pull request #1859 from ceph/container-limit
container: introduce resource limitation for containers
2017-09-07 12:51:34 +02:00
Sébastien Han 2fa151b9e8 container: introduce resource limitation for containers
This can be controlled via 2 options:

* ceph_$DAEMON_docker_memory_limit
* ceph_$DAEMON_docker_cpu_limit

All daemons default to 1GB for memory and 1 CPU by default.
Recommendations from:
https://access.redhat.com/documentation/en-us/red_hat_ceph_storage/2/html/red_hat_ceph_storage_hardware_guide/minimum_recommendations

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-09-06 14:52:21 +02:00
Sébastien Han b7db600caa switch-from-non-containerized-to-containerized: mask unit files
We must mask the image so we are sure that even if the system reboots
then the OSDs won't start.

Also remove Ceph udev rules if found on the system prior to deploy
containers. If we don't do this we are exposed to conflicts between udev
rules and sytemd unit files.

Also add the CI will now test the migration from a non-containerized cluster to a
containerized cluster.

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-09-05 15:20:31 +02:00
Sébastien Han 1f4082f200 update meta for ansible galaxy
Closes: https://github.com/ceph/ceph-ansible/issues/1637
Signed-off-by: Sébastien Han <seb@redhat.com>
2017-08-25 00:05:44 +02:00
Sébastien Han 76ac9b077b ceph-mon: detect ANSIBLE_ROLES_PATH if present
Some deployments can't copy infrastructure playbooks outside of the
infrastructure-playbooks directory. Thus they use ANSIBLE_ROLES_PATH to
overcome this. However some roles have 'playbook_dir' hardcoded, which
results in wrong path since the execution comes from
infrastructure-playbooks. Basically the role triggered by a playbook
from infrastructure-playbooks believes that the roles are in
infrastructure-playbooks/roles. This commit fixes that.

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-08-24 16:19:39 +02:00
Sébastien Han 6d894e556c ceph-mon: remove hardcoded ipv4 in containers
Before this commit we were forcing ipv4 which might not be available.
Now setting ip_version to ipv4 or ipv6 will give you the right support.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1484189
Signed-off-by: Sébastien Han <seb@redhat.com>
2017-08-24 11:33:02 +02:00
Jason Dillaman 70c2b934ca distribute rbd bootstrap key if available
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2017-08-22 18:55:29 -04:00
Sébastien Han 07821d9bb1 Merge pull request #1786 from ceph/re-arrange-skipped
mon, osd: fix skipped condition
2017-08-22 19:44:48 +02:00
Sébastien Han a359fc35b4 mon, osd: fix skipped condition
To be properly evaluated the "skipped" conditions must always have the
first place on the list of condition, otherwise the other conditions are
evaluated before and make the task fail.

Closes: https://github.com/ceph/ceph-ansible/issues/1733
Signed-off-by: Sébastien Han <seb@redhat.com>
2017-08-22 18:34:51 +02:00
Andy McCrae 4671b9e74e Allow ceph service systemd overrides to be specified
ceph services can fail to start under certain circumstances (for
example, when running in a container) because the default systemd
service configuration causes namespace issues.

To work around this we can override the system service settings by
placing an overrides file in the ceph-<service>@.service.d directory.
This can be generic so as to allow any potential changes required to
the ceph-<service> service files.

The overrides file is only setup when the
"ceph_<service>_systemd_overrides" config_template override variable is
specified.

The available service systemd override files are as follows:
ceph_mds_systemd_overrides
ceph_mgr_systemd_overrides
ceph_mon_systemd_overrides
ceph_osd_systemd_overrides
ceph_rbd_mirror_systemd_overrides
ceph_rgw_systemd_overrides
2017-08-16 17:57:06 +01:00
John Fulton c04559181e Set the permissions mode on all of the OpenStack keys
The original fix to issue #1755 only set the permissions on
the monitors to which the key was copied, but not the original
monitor where the key was created. Thus, we use a separate task
to set the permission of the key.
2017-08-10 13:50:08 -04:00
John Fulton 7d42941090 Allow user to specify the mode of the openstack keys
The openstack_keys structure now supports a key called mode
whose value is a string that one could pass to chmod to set
the mode of the key file. The ansible file module applies the
mode to all openstack keys with this property.

Fixes: #1755
2017-08-10 15:34:39 +00:00
Guillaume Abrioux 7a333d05ce Add handlers for containerized deployment
Until now, there is no handlers for containerized deployments.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-08-02 17:12:20 +02:00
Guillaume Abrioux fc6b6e9859 Move basics facts to `ceph-defaults`
Move `fsid`,`monitor_name`,`docker_exec_cmd` and `ceph_release` set_fact
to `ceph-defaults` role.
It will allow to reuse these facts without having to play `ceph-common`
or `ceph-docker-common`.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-08-02 17:12:20 +02:00
Guillaume Abrioux 5adbf0fdaa Move role dependencies in site.yml/site-docker.yml
This will give us more flexibility and avoid a lot of useless when
skipping all tasks from a non-desired role.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-08-02 17:12:14 +02:00
Guillaume Abrioux 1d003aa887 merge docker-common and common defaults vars
Merge `ceph-docker-common` and `ceph-common` defaults vars in
`ceph-defaults` role.
Remove redundant variables declaration in `ceph-mon` and `ceph-osd` roles.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-08-02 14:46:51 +02:00
Sébastien Han 2566db3e7c mon: add mgr cap to admin key
Signed-off-by: Sébastien Han <seb@redhat.com>
2017-07-24 16:00:06 +02:00
John Fulton 73633f05a0 Allow user to define ACLs for OpenStack keys
The keys and openstack_keys structure now supports an optional
key called acls whose value is a list of strings one could pass
to setfacl. The ansible ACL module applies the ACLs to all
openstack keys with this property.

Fixes: #1688
2017-07-20 13:20:16 +00:00
Guillaume Abrioux 07fb79ce13 Mon: Copy openstack keyring files on all mons
Copies all created openstack keys on all mons.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-07-19 16:28:18 +00:00
Guillaume Abrioux 151d59db4e Mon: Create rbd pool on luminous
There is no more an rbd pool that comes with luminous.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-07-18 01:01:53 +02:00
Guillaume Abrioux d11975800c Common: change path for fetch_directory
Some tasks fetch file to `{{ fetch_directory }}/docker_mon_files` and
then try to copy from `{{ fetch_directory }}/{{ fsid }}`. That causes
the playbook to fail.

Fixes: #1683

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-07-17 21:11:01 +02:00
Guillaume Abrioux d0311c6aa3 Client: keep consistency between `openstack_key` and `keys`
To keep consistency between `{{ openstack_keys }}` and `{{ keys }}`
respectively in `ceph-mon` and `ceph-client` roles.
This commit also add the possibility to set mds caps.

Fixes: #1680

Co-Authored-by: John Fulton <johfulto@redhat.com>
Co-Authored-by: Giulio Fidente <gfidente@redhat.com>
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-07-17 21:11:01 +02:00
Guillaume Abrioux da755cb317 Doc: containerized deploy with custom admin secret
In addition to ceph/ceph-docker@69d9aa6, this explains how to deploy a
containerized cluster with a custom admin secret.
Basically, just need to pass the `admin_secret` defined in your
`group_vars/all.yml` to the `ceph_mon_docker_extra_env` variable.

Eg:

`ceph_mon_docker_extra_env: -e CLUSTER={{ cluster }} -e FSID={{ fsid }}
-e MON_NAME={{ monitor_name }} -e ADMIN_SECRET={{ admin_secret }}`

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-07-07 16:29:56 +02:00
Guillaume Abrioux 7e1df484db Mon: Allow to deploy with custom admin secret
Add a new parameter `admin_secret` that allow to deploy a ceph cluster
with a custom admin secret.

Fix: #1630

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-07-05 14:57:49 +02:00
Sébastien Han adf752f241 Merge pull request #1597 from czunker/openstack_pools_with_rule
Create OpenStack pools with crush rule
2017-07-04 18:34:00 +02:00
Guillaume Abrioux 896d62d78b Refact: remove ceph_mon_docker_interface variable
remove `ceph_mon_docker_interface` and use `monitor_interface` instead
for both containerized and non-containerized deployment.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-07-04 18:08:59 +02:00
Guillaume Abrioux a951b7f957 Docker-common: Add missing variables declaration
Some variables are missing from ceph-docker-common role since the
include of check_mandatory_vars.yml has been re-added in the ceph-mon
role.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-07-04 17:50:23 +02:00
Sébastien Han 1c2d3a0b79 Merge pull request #1594 from ceph/ipv6_support
Common: Add ipv6 support
2017-07-04 15:08:47 +02:00
Guillaume Abrioux 0ab9be9a7a Mon: Readd the include of check_mandatory_vars.yml
The check regarding the networking scenario configuration has been
moved from ceph-common to ceph-mon in 1de8176 but the include was not re-added
in 189f4fe

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-07-04 10:57:27 +02:00
Guillaume Abrioux 88df105d0b Common: Add ipv6 support
e8187f6 does not fix the ipv6 as expected since `ansible_default_*` are
filled with the IP address carried by the network interface used by the
default gateway route. By the way, it assumes that the MON_IP address will
be this IP address which is not always the case.

We need to keep using the previous fact but add some intelligence in the
template to determine how to retrieve the ipv4|ipv6 address since the path
to the fact in `hostvars` is not the same according to ipv4 vs ipv6 case.

Fix: 1569

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-07-04 10:57:26 +02:00
Christian Zunker 0050f8e6ef Create OpenStack pools with crush rule
Add an extra variable to the openstack pools, which creates them with
defined rules. This will allow to place different pools on e.g.
different type of disks.

This commit will also set a new default rule when defined and move
the rbd pool to the new rule.
2017-07-03 15:30:38 +02:00
Florian Haas 18e6c35dee Ensure that ceph-mon applies mon directory ownership recursively
Fixes #1635.

Signed-off-by: Florian Haas <florian@hastexo.com>
2017-06-30 10:18:51 +02:00
Sébastien Han d6ba1d1d4e mon: fix openstack key creation
Somehow the shell module will return an error if the command line is not
next to it.
Plus fixed the import with the right path.

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-06-27 11:47:02 +02:00
Sébastien Han 0c58257004 Merge pull request #1621 from ceph/openstack-key
mon: rework openstack keys creation
2017-06-26 14:39:05 +02:00
Sébastien Han 670d7a2495 mon: rework openstack keys creation
We now allow a user to pass a key secret.

Fixes: https://github.com/ceph/ceph-ansible/issues/1617
Signed-off-by: Sébastien Han <seb@redhat.com>
2017-06-26 13:39:22 +02:00
Sébastien Han 0c21fb3f66 docker: ability to change ceph config directory
Signed-off-by: Sébastien Han <seb@redhat.com>
2017-06-26 13:21:56 +02:00
Sébastien Han 7bb04a5970 docker: refactor followup
Followup on https://github.com/ceph/ceph-ansible/pull/1469 where we
merged most of the container code from roles/ceph-*/task/docker/*.yml
into roles/ceph-docker-common/tasks/

It seems that we forgot to remove the original files.

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-06-26 13:21:36 +02:00
John Fulton 9619ef33d0 Add OpenStack metrics pool
OpenStack's Gnocchi service expects to have a pool called "metrics".
This change addess "metrics" to the list of `openstack_pools` and
creates a corresponding key. It is only run if the user sets
`openstack_config: false`.
2017-06-19 14:25:59 -04:00
Sébastien Han 497924795d ceph-mon: fix get rbd size hanging
For newly created cluster the command: ceph --cluster {{ cluster }} osd
pool get rbd size does not respond properly.
We only want to check if the rbd pool exists, so we know use an ls |
grep approach.

Closes: https://github.com/ceph/ceph-ansible/issues/1547
Signed-off-by: Sébastien Han <seb@redhat.com>
2017-06-12 14:39:39 +02:00
Andrew Schoen e8187f6a0f ceph-mon: fix support for ipv6 on containerized mons
The fact ['ansible_$interface']['ipv4'] is a dictionary where
['ansible_$interface']['ipv6'] is a list. If we use
ansible_default_ipv6|ipv4 is is always a dictionary which allows us to
get the ipv6 and ipv4 address without adding more complexity to the
template.

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
2017-06-05 10:51:47 -05:00
Guillaume Abrioux ddfe019342 Refact code
`ceph-docker-common`:
  At the moment there is a lot of duplicated tasks in each
  `./roles/ceph-<role>/tasks/docker/main.yml` that could be refactored in
  `./roles/ceph-docker-common/tasks/main.yml`.

`*_containerized_deployment` variables:
  All `*_containerized_deployment` have been refactored to a single
  variable `containerized_deployment`

duplicate `cephx` variables in `group_vars/* have been removed.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-05-24 15:55:41 +02:00
Sébastien Han c7aae7f965 mon: do not hardcode ipv4
Problem: fail to deploy a containerized Ceph cluster with ipv6
Solution: do not hardcode ipv4 when bootstrapping the container.

Now use ip_version: ipv6 to get a containerized cluster deployed with
ipv6.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1451786
Signed-off-by: Sébastien Han <seb@redhat.com>
2017-05-18 11:56:55 +02:00
Sébastien Han cf25ebb17c Merge pull request #1500 from yanyixing/master
ignore error when key is not exist
2017-05-17 15:04:20 +02:00
Sébastien Han f1651cea9b mon: do not create mgr key on jewel
The CI on Docker is reporting the following error:

STDERR:
Error EINVAL: bad entity name

This is due to the fact that this auth entity name does not exist on
Jewel so we should not create that key when running Jewel containers.

Fixes: https://github.com/ceph/ceph-ansible/issues/1514

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-05-12 17:22:24 +02:00
yanyx 027f9aaf09 ignore error when key is not exist 2017-05-05 16:44:58 +08:00
Guillaume Abrioux 48bd807508 Common: Do not install ceph-mgr packages on jewel
ceph-mgr tasks has to be skipped on jewel.

Fix: #1494

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-05-04 18:38:59 +02:00
Sébastien Han 84d96be197 mon: upgrade calamari when running rolling_update playbook
Prior to this change, ansible was only checking for the existence of the
package, now if upgrade_ceph_packages is true this means we are
performing an upgrade.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1442016

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-04-24 11:05:13 +02:00
John Spray 3a0d03656f mon: update mgr key capabilities
This is to allow ceph-mgr daemons to remote control
osd and mds daemons with MCommand messages.

Fixes: http://tracker.ceph.com/issues/19713
Signed-off-by: John Spray <john.spray@redhat.com>
2017-04-21 12:15:25 +01:00
Sébastien Han dfd8f4d96e test: add mgr section to the host inventory file
Without this, we don't test the mgr role so we need to add it.

Co-Authored-by: Guillaume Abrioux <gabrioux@redhat.com>
Signed-off-by: Sébastien Han <seb@redhat.com>
2017-04-15 00:16:10 +02:00
Andrew Schoen 9ce0c2808e ceph-mon: change command to see if rbd exists
The previous command was hanging, see this issue:

https://github.com/ceph/ceph-ansible/issues/1440

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
2017-04-12 15:07:10 -05:00
Sébastien Han 05331a2634 mon: fix with_items being evaluated before when
Ansible evaluates the 'with_items' before the 'when' so if the inventory
does not have the group declared it'll fail. To fix this, we set an
empty array to make the with_items happy and then evaluate with the
'when'.

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-04-11 12:10:55 +02:00
Sébastien Han d113cf854c Merge pull request #1377 from ceph/ceph-mgr
mgr: add new role for ceph-mgr
2017-04-10 17:50:24 +02:00
Sébastien Han 12b2aa2e55 docker: fix monitors name
Prior to this change we were deploying a monitor using tis fqdn name but
we were checking its state and performing actions on it using its
shortname.

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-04-10 15:13:12 +02:00
Sébastien Han 2aa5286544 mgr: add new role for ceph-mgr
The Ceph Manager daemon (ceph-mgr) runs alongside monitor daemons, to
provide additional monitoring and interfaces to external monitoring and
management systems.

Only works as of the Kraken release.

Co-Authored-By: Guillaume Abrioux <gabrioux@redhat.com>
Signed-off-by: Sébastien Han <seb@redhat.com>
2017-04-10 15:13:09 +02:00
WingkaiHo 6ad8288c91 enable ceph-mon.target service after monitor start
ceph-create-keys unit file was removed here:

* 8bcb4646b6
* dc5fe8d415

As a consequence the systemctl preset command now fails to run since the
unit does not exist anymore. Due to the redirection in /dev/null we
don't know what's happening.

Ultimately the mon unit doesn't get enabled and the mon service won't
start after reboot.
Removing the old/non-existent unit makes the command succeed now.

ceph fix: https://github.com/ceph/ceph/pull/14226

Signed-off-by: WingkaiHo <sanguosfiang@163.com>
Co-Authored-By: Sébastien Han <seb@redhat.com>
2017-04-06 16:58:32 +02:00
Konstantin Shalygin 1662976fc0
Resolve issues when groups names not in default value. 2017-03-27 21:44:30 +07:00
Guillaume Abrioux 589d6812ca ceph-docker: fix bootstrap directories permissions
Make bootstrap directories permissions work for both RedHat and Debian
os families.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
Fix: #1338
2017-03-22 11:18:56 +01:00
Andrew Schoen ec5ce81884 ceph-mon: always call ceph-create-keys
After the jewel release the mon startup does not generate keys, but it's
still harmless to call ceph-create-keys with jewel because this task has
a 'creates' argument that will cause it not to run if the keys already
exist.

Removing this when condition also allows the downstream CI tests to
install kraken or luminous without resetting ceph_stable_release, which does not
pertain to rhcs.

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
2017-03-16 16:31:25 -05:00
Sébastien Han 0609786ce6 Merge pull request #1331 from guits/enh_1321
ceph-mon: create openstack pools and keys even for containerized deployments
2017-03-16 13:28:45 +01:00
Sébastien Han 60a56b5d4a mon: increase wait for monitor socket timeout
Sometimes the socket appears during the 5th attempt and sometimes not so
increasing the timeout a little bit.

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-03-16 11:16:49 +01:00
Guillaume Abrioux ea68fbaaae ceph-mon: Create openstack pools and keys even for containerized deployments
Add the possibility to create openstack pools and keys even for containerized deployments

Fix: #1321
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-03-16 10:53:53 +01:00
Sébastien Han 38ab6de602 Merge pull request #1336 from WingkaiHo/master
Load a variable file for devices partition
2017-03-15 11:55:26 +01:00
Sébastien Han 8320c14191 Merge pull request #1317 from ibotty/harmonize-docker-names
harmonize docker names
2017-03-14 18:20:20 +01:00
Boris Ranto 3c6a7a60eb calamari: Add debugging option
This patch introduces calamari_debug option which will turn on debugging
for calamari before initializing and running it.

Signed-off-by: Boris Ranto <branto@redhat.com>
2017-03-14 10:53:05 +01:00
Sébastien Han b55a0702c2 Merge pull request #1335 from batrick/mon-fs-cmd-1mon
send fs commands to one mon
2017-03-07 16:45:16 +01:00
Guillaume Abrioux 66b59ea9c6 docker: Fix #1303
Install package from official repos rather than pip when using RHEL.

This commit fix https://bugzilla.redhat.com/show_bug.cgi?id=1420855

Also this commit Refact all `roles/ceph-*/tasks/docker/pre_requisite.yml`
to avoid a lot of duplicated code.

Fix: #1303
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-03-03 10:49:13 +01:00
WingKai Ho 029eb2a6d3 Update ceph_keys.yml 2017-03-02 14:09:08 +08:00
WingKai Ho 62892fbdf6 Update ceph_keys.yml 2017-03-02 14:07:52 +08:00
Patrick Donnelly 56d8367339
send fs commands to one mon
Add-on to #1329.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2017-03-01 11:05:56 -05:00
WingKai Ho 997fe5b198 Update ceph_keys.yml 2017-03-01 17:39:53 +08:00
Guillaume Abrioux e00b745a6c ceph-mon: Check if ceph filesystem exists
Check if ceph filesystem already exists before creating it.
If the ceph filesystem doesn't exist, execute the task only on one node.

Fix: #1314
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-02-24 09:11:52 +01:00
Tobias Florek 931027e6f7 harmonize docker names
Created containers now are named more or less in the form of

    <ansible role>-<ansible_hostname>
2017-02-23 09:15:05 +01:00
Sébastien Han 458a9ad5c3 mon: docker, ability to enable centos extra repo
Signed-off-by: Sébastien Han <seb@redhat.com>
2017-02-21 15:56:09 -05:00
WingKai Ho 421d1a2853 Update ceph_keys.yml
jewel version need to build the {{ cluster }}.client.admin.keyring exists key
2017-02-21 09:49:52 +08:00
Andrew Schoen c5a5658e09 Merge pull request #1301 from guits/fix_1294
Check if ceph_conf_overrides.global is defined before calling it
2017-02-10 10:20:14 -06:00
Andrew Schoen 94ac749918 Merge pull request #1302 from ceph/docker-pull
docker: use a better method to pull images
2017-02-10 10:18:37 -06:00
Guillaume Abrioux e63631a4ab bugfix: Add missing conditions for kraken release
76ddcbc introduced an issue by removing some needed conditions on tasks
that need to be run only on release >= kraken.
2017-02-10 15:14:54 +01:00
Guillaume Abrioux 4295d427b9 Check if ceph_conf_overrides.global is defined before calling it
Expand the fix in #1291 to all the playbook in order to get a full coverage.

Fix: #1294
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-02-09 20:28:58 +01:00
Sébastien Han c2f1dca823 docker: use a better method to pull images
We changed the way we declare image.
Prior to this patch we must have a "user/image:tag"
format, which is incompatible with non docker-hub registry where you
usually don't have a "user". On the docker hub a "user" is also
identified as a namespace, so for Ceph the user was "ceph".

Variables have been simplified with only:

* ceph_docker_image
* ceph_docker_image_tag

1. For docker hub images: ceph_docker_name: "ceph/daemon" will give
you the 'daemon' image of the 'ceph' user.

2. For non docker hub images: ceph_docker_name: "daemon" will simply
give you the "daemon" image.

Infrastructure playbooks have been modified as well.
The file group_vars/all.docker.yml.sample has been removed as well.
It is hard to maintain since we have to generate it manually. If
you want to configure specific variables for a specific daemon simply
edit group_vars/$DAEMON.yml

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1420207
Signed-off-by: Sébastien Han <seb@redhat.com>
2017-02-09 17:57:18 +01:00
Guits df162a61b1 ceph-mon: Fix bug #1242
We shouldn't test directly the value of
`ceph_conf_overrides.global.osd_pool_default_pg_num` because this can
cause the playbook to fail if the key `global` is not present in
`ceph_conf_overrides`. Therefore we have to use the facts that have been
defined earlier.

Fix: #1242

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-02-08 10:46:46 +01:00
Sébastien Han 2ed93875a9 docker: fix monitor addition on kraken
Probably not the best fix but useful for testing. We will remove this
once we find a better workaround.

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-02-03 11:35:54 +01:00
Sébastien Han 6d5afdfb99 docker: fix restapi key creation with cluster name
Add support for key creation when the cluster name is different than
'ceph'.

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-02-02 09:32:12 +01:00
Sébastien Han cb499a689b docker: fix mkdir path for all the distros
On ubntu systems mkdir is in /bin where on atomic it is /usr/bin/.
We use the shell built-in function "command" to find its right location.

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-02-01 17:19:07 +01:00
Sébastien Han 40709c8336 docker: use systemd to manage container
Since we now only support systemd has an init system we can finally
treat containers as processes using systemd and this for all the
distros.

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-02-01 17:12:46 +01:00
Guillaume Abrioux 76ddcbc271 Remove support of releases prior to Jewel.
According to #1216, we need to simply the code by removing the
support of anything before Jewel.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2017-01-31 11:00:54 +01:00
Sébastien Han e35070f6ce mon: make sure osd_pool_default_size is honoured
This patch makes sure we set the proper pool size on the rbd pool.
Usually during bootstrap the rbd pool size is not honoured so we need to
add this workaround.

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-01-25 22:53:17 +01:00
tynorth-cisco 6400989cf2 add unique filter to openstack pool names
could have scenario where different openstack components would
use the same pool, but the logic would create the same pool
more than once

add unique filter to account for this
2017-01-23 11:58:28 -08:00
Sébastien Han 90648e7518 mon: fix mds pool creation
It is not enough to check for the mds to exists, it actually always does
because we declare the variable. So we need to make sure that there is a
mds host.

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-01-19 14:49:09 +01:00
Sébastien Han ddac3a1fb5 mon: pool creation and pgs
Since we introduced config_overrides we removed a lot of options from
the default template. In some cases, like mds pool, openstack pools etc
we need to know the amount of PGs required. The idea here is to skip the
task if ceph_conf_overrides.global.osd_pool_default_pg_num is not define
in your `group_vars/all.yml`.

Closes: #1145

Signed-off-by: Sébastien Han <seb@redhat.com>
Co-Authored-By: Guillaume Abrioux <gabrioux@redhat.com>
2017-01-19 11:30:39 +01:00
Sébastien Han c6728ca21d Merge pull request #1229 from ceph/docker-fixes
adds a ceph-docker-common role and enables custom registry usage
2017-01-18 14:54:12 +01:00
Musee Ullah 7636d09f92
mon: run ceph-create-keys after startup for kraken release 2017-01-17 22:51:39 +09:00
Andrew Schoen 655b8449ae use ceph_docker_registry when starting containers
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
2017-01-16 11:17:41 -06:00
Andrew Schoen 9449dbf083 use ceph_docker_registry in all the roles instead of docker.io
This allows for ceph-ansible to use other docker registries.

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
2017-01-16 10:42:42 -06:00
Andrew Schoen c07b7ddbaa use ceph-docker-common in roles that support docker deployments
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
2017-01-16 09:30:53 -06:00
Sébastien Han 468afa2d5b mon: only put mon initial key in mon kv when cephx is enabled
Task put initial mon keyring in mon kv store from
ceph-mon/tasks/ceph_keys.yml is failing when cephx is disabled. The root
cause is that variable monitor_keyring is not populated by any task from
deploy_monitors.yml.

Fixes: #1211

Signed-off-by: Sébastien Han <seb@redhat.com>
2017-01-02 11:16:03 +01:00
tynorth-cisco 704b49ba33 use monitor name, not host ansible host in ceph.conf
in ceph-common there is a fact check for monitor name
that will set it to ansible_host or ansible_fqdn
2016-12-19 12:33:38 -08:00
Andrew Schoen 99d66e09d9 Merge pull request #1153 from ceph/cluster-name-test
test: add cluster name support test scenario
2016-12-16 13:10:52 -06:00
Sébastien Han 2d8ac4a586 docker: only use systemd to manage containers
Prior to this patch we had several ways to runs containers, we could use
ansible's docker module on some distro and on containers distros we were
using systemd. We strongly believe threating containers as services with
systemd is the right approach so this patch generalizes to all the
distros. These days most of the distros are running systemd so it's fair
assumption.

Signed-off-by: Sébastien Han <seb@redhat.com>
2016-12-16 19:37:05 +01:00
Sébastien Han ce7431a227 docker: add support for cluster name
We need to honour the cluster name that was chosen by ceph-ansible and
pass it to ceph-docker.

Signed-off-by: Sébastien Han <seb@redhat.com>
2016-12-16 14:31:21 +01:00
Sébastien Han 608b008a95 mon: add the initial mon keyring to the mon store
Once we have our first monitor up and running we need to add it to the
monitor store as a safety measure. Just in case the local file gets
deleted and you need to add a new monitor. Now you can retrieve this key
like this:

ceph config-key get initial_mon_keyring > initial_mon_keyring.txt

Signed-off-by: Sébastien Han <seb@redhat.com>
2016-12-16 11:54:02 +01:00
Sébastien Han f0687995e1 common: add the name of the ceph conf file in the play
Just for clarity and because we can we now show the name of the
ceph configuration file that is generated.

Signed-off-by: Sébastien Han <seb@redhat.com>
2016-12-15 15:26:01 +01:00
Guillaume Abrioux 471be5e629 common: do not regenerate initial mon keyring if cluster exists
This commit solves the situation where you lost your fetch directory and
you are running ansible against an existing cluster. Since no fetch
directory is present the file containing the initial mon keyring
doesn't exist so we are generating a new one.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2016-12-15 14:39:56 +01:00
Sébastien Han f6736e5420 common: show which file we are waiting for
We can now see the name of the file we are waiting for, depending on the
cluster name this will change.

Signed-off-by: Sébastien Han <seb@redhat.com>
2016-12-14 21:08:18 +01:00
tynorth-cisco 3c6e156d08 Change attribute call to .get call in ceph keys
If previous check was not run, .stdout_lines is not a valid key on the dictionary.
To get around this, use .get("stdout_lines") instead.

Also add in a default empty list
2016-12-13 16:48:14 -08:00
Sébastien Han 189f4fee47 common: do not run tasks in main.yml, use include
For readibility and clarity we do not run any tasks directly in the
main.yml file. This file should only contain include, which helps us
later to apply conditionnals if we want to.

Signed-off-by: Sébastien Han <seb@redhat.com>
2016-12-09 16:00:46 +01:00
Sébastien Han 75cb749570 docker: consolidate ceph-ansible and ceph-docker varible
This commit re-uses some of the existing ceph-ansible variables for a
containirzed deployment. There is no reasons why we should add new
variables for the containerized deployment.

Signed-off-by: Sébastien Han <seb@redhat.com>
2016-12-09 14:39:05 +01:00
Sébastien Han 93c3988bfe mon: remove collect keys
Once the monitor process starts it will also trigger `ceph-create-keys`
which will collect the admin key and bootstrap keys. We used to force
this command because we were having issues on some distros like centos
7.0 and 7.1 not triggering this. This is fixed on centos 7.2 and not an
issue on ubuntu 14.04 or 16.04 so we can remove this task. If the
monitor hangs or fails to start the playbook will fail right after at
the "wait for client.admin key exists" task after 300sec.

Closes: #1161

Signed-off-by: Sébastien Han <seb@redhat.com>
2016-12-07 14:38:39 +01:00
Andrew Schoen aeab09938a ceph-mon: no need to include playbook_dir when fetching configs
This causes a bug when fetch_directory is not a relative path to the
playbook location.

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
2016-12-01 10:28:54 -06:00
Andrew Schoen 1e64eb7111 ceph-mon: adds static: no to an include to avoid an ansible bug
Adding that avoids this bug:

https://github.com/ansible/ansible/issues/18206

Without that you'll get failures like:

TASK [ceph-mon : set keys permissions]
*****************************************
task path:
/home/andrewschoen/ceph-ansible/roles/ceph-mon/tasks/ceph_keys.yml:31
fatal: [mon0]: FAILED! => {"failed": true, "msg": "'dict object' has no attribute 'stdout_lines'"}

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
2016-12-01 10:28:54 -06:00
Guillaume Abrioux 76220ed719 Use 'package' module instead of yum, apt and dnf
Refactor the code using 'package' module

Fix Issue #520

(However it doesn't cover all cases because some cases are not refactorable.
Ex: because of diverging packages name between distribution)
2016-11-29 17:29:11 +01:00
Daniel Marks 9337b19ac0 Better --check compatibility for ceph-mon role
Carefully chosen "always_run: true" parameters for read-only tasks that
register variables. This enables --check runs (at least on deployed
clusters).
2016-11-26 21:05:32 +01:00
Daniel Marks 320dba7490 Better --check compatibility for ceph-mon role
Carefully chosen "always_run: true" parameters for read-only tasks that
register variables. This enables --check runs (at least on deployed
clusters).
2016-11-24 11:54:10 +01:00
Ivan Font 3ff17f1c8f Support containerized rolling update
- Update rolling update playbook to support containerized deployments
  for mons, osds, mdss, and rgws
- Skip checking if existing cluster is running when performing a rolling
  update
- Fixed bug where we were failing to start the mds container because it
  was missing the admin keyring. The admin keyring was missing because
  it was not being pushed from the mon host to the ansible host due to
  the keyring not being available before running the copy_configs.yml
  task include file. Now we forcefully wait for the admin keyring to be
  generated before continuing with the copy_configs.yml task include file
- Skip pre_requisite.yml when running on atomic host. This technically
  no longer requires specifying to skip tasks containing the with_pkg tag
- Add missing variables to all.docker.sample
- Misc. cleanup

Signed-off-by: Ivan Font <ifont@redhat.com>
2016-11-17 11:25:25 -08:00
Sébastien Han a2fcd222d2 moving to ansible v2.2 compatibility
Signed-off-by: Sébastien Han <seb@redhat.com>
Co-Authored-By: Julien Francoz julien@francoz.net
2016-11-04 10:09:38 +01:00
Adam Huffman 3b9f4f7de3 Revert "Change enabling of extras repo for CentOS to use ini_file" 2016-10-26 10:04:59 +02:00
Leseb 4883fa6161 Merge pull request #1042 from verdurin/centos-extras-ini_file
Change enabling of extras repo for CentOS to use ini_file
2016-10-25 09:50:52 +02:00
Sébastien Han 1e6c418a65 mon: destroy and recreate rbd pool if necessary
Users reported that pool_default_pg_num is not honoured for the default
pool 'rbd'. So now we check the pg num value for the RBD pool and if it
does not match pool_default_pg_num then we delete and recreate it.
We also make sure the pool is empty first, just in case someone changed
the value manually and didn't reflect the change in ceph-ansible.

The only issue with this patch is that the pool ID will not be 0 anymore
but more likely 1.

Signed-off-by: Sébastien Han <seb@redhat.com>
2016-10-22 01:31:15 +02:00
Adam Huffman 68bafc1fd0 Change enabling of extras repo for CentOS to use ini_file
Signed-off-by: Adam Huffman <bloch@verdurin.com>
2016-10-19 22:15:14 +01:00
Adam Huffman 4315166e91 Remove superfluous distro family check
Signed-off-by: Adam Huffman <bloch@verdurin.com>
2016-10-17 10:39:06 +01:00
Adam Huffman f3dea0d40a Ensure extras repo enabled on CentOS 2016-10-16 23:23:43 +01:00
Patrick Donnelly 4127828094
multimds: add commands to enable and set max_mds
Also regenerated group_vars.

Fixes #986.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2016-10-04 09:40:20 -06:00
Patrick Donnelly c5d2170d96
secure_cluster: fix leftover version check
Missed by #953.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2016-10-04 09:39:44 -06:00
James Saint-Rossy 9c7dac6b94 Updated release version check 2016-09-30 11:43:53 -04:00
James Saint-Rossy d36a99e41b Used list style ands for better readibility and fixed legacy debian checks 2016-09-26 09:19:15 -04:00
James Saint-Rossy 982c44d41c Rebased with upstream master 2016-09-25 23:22:16 -04:00
Paulo Matias a13094b888 Allow deployer to customize openstack pools
By overriding the openstack_pools variable introduced by this commit, the
deployer may choose not to create some of the openstack pools, or to add
new pools which were not foreseen by ceph-ansible, e.g. for a gnocchi
storage backend.

For backwards compatibility, we keep the openstack_glance_pool,
openstack_cinder_pool, openstack_nova_pool and
openstack_cinder_backup_pool variables, although the user may now choose
to specify the pools directly as dictionary literals inside the
openstack_pools list.
2016-09-21 14:49:42 -03:00
Patrick Donnelly 35c64f91f4
deploy_monitors: use python2 for v2 code
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2016-09-18 20:42:14 -04:00
James Saint-Rossy d4a60a9394 Added ceph_release generation and fixed missing whitespace in ceph_release checks 2016-09-09 18:16:41 -04:00
James Saint-Rossy 666637f715 Replaced is_before is_after is_ booleans with numerical version dictionary 2016-09-09 17:34:26 -04:00
James Saint-Rossy f52be23770 Prevent local_action from requiring root 2016-09-02 19:31:59 -04:00
James Saint-Rossy 9d97ffed30 Rebasing with upstream 2016-08-31 17:13:09 -04:00
Ivan Font 94f8d8540a NFS fixes
- Move mon_containerized_default_ceph_conf_with_kv config from ceph-mon
  to ceph-common defaults as it's used in ceph-nfs
- Update conditional to generate ganesha config when not
  mon_containerized_default_ceph_conf_with_kv
- Revert change to store radosgw keyring using ansible_hostname on
  ansible server so that ceph-nfs can find it
- Update ceph-ceph-nfs0-rgw-user container to use ansible_hostname
  variable

Signed-off-by: Ivan Font <ivan.font@redhat.com>
2016-08-25 22:41:31 -07:00
Sébastien Han a4dbe49f7f docker: fix more than one monitor deployment
There is no need to run the actions from
roles/ceph-mon/tasks/docker/create_configs.yml
on the first monitor only since the monitor deployment happens
**serially**.
Moreover with Vagrant it's useful to allow the auto creation of the
cluster fsid, so enabling the option. If this is not desired you can
still set `fsid: 9c9c0448-0551-401d-b55b-e5b3a42bae42` for example.

Signed-off-by: Sébastien Han <seb@redhat.com>
2016-08-24 09:05:14 +02:00
Sébastien Han f351329897 docker: use cluster name
Fix cluster name for docker scenario and other playbooks.

Signed-off-by: Sébastien Han <seb@redhat.com>
2016-08-24 09:04:49 +02:00
James Saint-Rossy 7e284920d1 Fixes for Hammer install and added numerical release checks 2016-08-24 00:23:47 -04:00
Daniel Lin 08766a243a Allow ceph-ansible to be run on a locally built/installed Ceph
-First install ceph into a directory with CMake
	cmake -DCMAKE_INSTALL_LIBEXECDIR=/usr/lib -DWITH_SYSTEMD=ON -DCMAKE_INSTALL_PREFIX:PATH:=/usr <ceph_src_dir> && make DESTDIR=<install_dir> install/strip

-Ceph-ansible copies over the install_dir

-User can use rundep_installer.sh to install any runtime dependencies that ceph needs onto the machine from rundep
2016-08-12 10:02:15 -04:00
Ivan Font 8c67689d08 Add option to enable ntp
This fixes #845 for containerized deployments. We now also mount the
/etc/localtime volume in the containers in order to synchronize the host
timezone with the container timezone.

Signed-off-by: Ivan Font <ivan.font@redhat.com>
2016-08-08 10:16:48 -07:00
Alexey Sheplyakov 76a3d876ee ceph-mon: fix the loop in `secure the cluster' task
Deployment fails when the ``secure_cluster`` is false:

TASK [ceph-mon : secure the cluster]
*******************************************
fatal: [saceph-mon.vm.ceph.asheplyakov]: FAILED! => {"failed": true, "msg": "'dict object' has no attribute 'stdout_lines'"}
fatal: [saceph-mon2.vm.ceph.asheplyakov]: FAILED! => {"failed": true, "msg": "'dict object' has no attribute 'stdout_lines'"}
fatal: [saceph-mon3.vm.ceph.asheplyakov]: FAILED! => {"failed": true, "msg": "'dict object' has no attribute 'stdout_lines'"}

A conditional include evaluates all included tasks with the (additional)
conditional applied to every task [1]. Thus all tasks from `secure_cluster.yml'
are always evaluated (with an additional 'when: secure_cluster' condition).
The `secure the cluster' task iterates over ``ceph_pools.stdout_lines``
even if ``secure_cluster`` is false: in loops ansible applies conditional
to every item (by design) [2]. However the `collect all the pools' task
is skipped if the very same condition evaluates to false, which leaves
the ``ceph_pools`` undefined, so the `secure the cluster' task fails:

Provide the default (empty) list to avoid the problem.

[1] http://docs.ansible.com/ansible/playbooks_conditionals.html#applying-when-to-roles-and-includes
[2] http://docs.ansible.com/ansible/playbooks_conditionals.html#loops-and-conditionals

Closes: #913

Signed-off-by: Alexey Sheplyakov <asheplyakov@mirantis.com>
2016-07-29 14:08:12 +03:00
Daniel Gryniewicz 352824cee7 Allow generating FSID for docker
The docker case wasn't able to generate an FSID, it required it to be
set.  Allow generating it.

Signed-off-by: Daniel Gryniewicz <dang@redhat.com>
2016-07-13 13:19:22 -04:00
Ivan Font 6f5f6610a8 Support for docker image tags
Signed-off-by: Ivan Font <ivan.font@redhat.com>
2016-07-12 15:49:07 -07:00
KGoreczny 11bed371ac remove trailing spaces
Signed-off-by: KGoreczny <krzysztof.goreczny@intel.com>
2016-07-12 14:50:56 +02:00
KGoreczny 13e0b60cbe Fix for Ansible 2.1: install docker-py in version matched to ansible docker module
Signed-off-by: KGoreczny <krzysztof.goreczny@intel.com>
2016-07-11 11:35:32 +02:00