Add mos_repos virtual resource and use it for ceph example

This commit is contained in:
Dmitry Shulyak 2015-10-16 13:14:33 +03:00
parent 5807a09609
commit bc3483f223
8 changed files with 73 additions and 4 deletions

View File

@ -22,3 +22,9 @@ debug info.
```
solar res action run ceph_mon1
```
To add repositories use
```
solar resource create apt1 templates/mos_repos.yaml node=node1 index=1
```

View File

@ -53,11 +53,15 @@ def deploy():
'role': 'controller',
})[0]
managed_apt = vr.create(
'managed_apt1', 'templates/mos_repos.yaml',
{'node': first_node.name, 'index': 0})[-1]
keys.connect(ceph_mon, {})
first_node.connect(ceph_mon,
{'ip': ['ip', 'public_vip', 'management_vip']})
library.connect(ceph_mon, {'puppet_modules': 'puppet_modules'})
managed_apt.connect(ceph_mon, {})
if __name__ == '__main__':
deploy()

View File

@ -0,0 +1,9 @@
- hosts: [{{host}}]
sudo: yes
tasks:
- shell: rm -f {{item}}
with_items:
- /etc/apt/sources.list.d/{{name}}.list
- /etc/apt/preferences.d/{{name}}.pref
- shell: apt-get update
when: {{validate_integrity}}

View File

@ -1,9 +1,11 @@
- hosts: [{{host}}]
sudo: yes
tasks:
- apt_repository: repo={{repo}} validate_certs=no
- file: path=/etc/apt/preferences.d/{{name}}.pref state=touch
- template:
src: {{templates_dir}}/source
dest: /etc/apt/sources.list.d/{{name}}.list
- template:
src: {{templates_dir}}/preferences
dest: /etc/apt/preferences.d/{{name}}.pref
- shell: apt-get update
when: {{validate_integrity}}

View File

@ -18,5 +18,8 @@ input:
schema: str
value:
pin_priority:
schema: str
schema: int
value:
validate_integrity:
schema: bool
value: true

View File

@ -0,0 +1 @@
{{repo}}

View File

@ -4,3 +4,4 @@
- shell: echo 'Managed by solar' > /etc/apt/sources.list
when: {{ensure_other_removed}}
- shell: apt-get update
when: {{ensure_other_removed}}

43
templates/mos_repos.yaml Normal file
View File

@ -0,0 +1,43 @@
id: mos_repos
resources:
- id: mos_holdback_{{index}}
from: resources/apt_repo
location: {{node}}
values:
name: mos-holdback
package: '*'
repo: deb http://mirror.fuel-infra.org/mos-repos/ubuntu/7.0/ mos7.0-holdback main restricted
pin: release o=Mirantis,n=mos7.0,a=mos7.0-holdback,l=mos7.0
pin_priority: 1100
- id: mos_security_{{index}}
from: resources/apt_repo
location: {{node}}
values:
name: mos
package: '*'
repo: deb http://mirror.fuel-infra.org/mos-repos/ubuntu/7.0/ mos7.0-security main restricted
pin: release o=Mirantis,n=mos7.0,a=mos7.0-security,l=mos7.0
pin_priority: 1050
- id: mos_updates_{{index}}
from: resources/apt_repo
location: {{node}}
values:
name: mos_update
package: '*'
repo: deb http://mirror.fuel-infra.org/mos-repos/ubuntu/7.0/ mos7.0-updates main restricted
pin: release o=Mirantis,a=mos7.0-updates,l=mos7.0,n=mos7.0
pin_priority: 1050
- id: managed_apt_{{index}}
from: resources/managed_apt
location: {{node}}
values:
names:
- mos_holdback_{{index}}::name
- mos_security_{{index}}::name
- mos_updates_{{index}}::name
repos:
- mos_holdback_{{index}}::repo
- mos_security_{{index}}::repo
- mos_updates_{{index}}::repo
ensure_other_removed: false