Merge pull request #262 from dshulyak/apt_repos

Apt repos
This commit is contained in:
Łukasz Oleś
2015-10-16 12:35:11 +02:00
10 changed files with 127 additions and 1 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

@@ -0,0 +1,11 @@
- hosts: [{{host}}]
sudo: yes
tasks:
- 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

@@ -0,0 +1,25 @@
id: apt_repo
handler: ansible
version: 1.0.0
input:
ip:
schema: str!
value:
repo:
schema: str!
value:
name:
schema: str!
value:
package:
schema: str
value: '*'
pin:
schema: str
value:
pin_priority:
schema: int
value:
validate_integrity:
schema: bool
value: true

View File

@@ -0,0 +1,3 @@
Package: {{package}}
Pin: {{pin}}
Pin-Priority: {{pin_priority}}

View File

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

View File

@@ -0,0 +1,7 @@
- hosts: [{{host}}]
sudo: yes
tasks:
- shell: echo 'Managed by solar' > /etc/apt/sources.list
when: {{ensure_other_removed}}
- shell: apt-get update
when: {{ensure_other_removed}}

View File

@@ -0,0 +1,17 @@
# This resource will clean
id: apt_repo_manager
handler: ansible
version: 1.0.0
input:
ip:
schema: str!
value:
repos:
schema: [str!]
value:
names:
schema: [str!]
value:
ensure_other_removed:
schema: bool
value: true

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