Skip to content

Commit 95311d2

Browse files
authored
Merge pull request #5 from GheRivero/master
Some cleanups for ubuntu hosts
2 parents 34860a7 + 1388904 commit 95311d2

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hosts

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ $ cat hosts
1111
**make sure the machine is reachable via SSH w/o password input before running the playbook**
1212

1313
```
14-
ssh-copy-id root@<ip or hostname>
14+
ssh-copy-id <user>@<ip or hostname>
1515
```
1616

1717
Then simply run:
1818

1919
```sh
20-
$ ansible-playbook -i hosts cri-o.yml
20+
$ ansible-playbook -i hosts cri-o.yml -u <user>
2121
```
2222

2323
You can then follow the `kubeadm` [docs](https://kubernetes.io/docs/getting-started-guides/kubeadm/) to install Kubernetes. I've tested the whole flow with a [custom Flannel pod network](https://gist.githubusercontent.com/sameo/cf92f65ae54a87807ed294f3de658bcf/raw/95d9a66a2268b779dbb25988541136d1ed2fbfe2/flannel.yaml), the official one seems broken.

cri-o.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
- hosts: all
3-
remote_user: root
3+
become: true
44
tasks:
55
- name: Make sure we have all required packages on Fedora
66
dnf:
@@ -54,8 +54,11 @@
5454
- pkgconfig
5555
- json-glib-devel
5656
- skopeo-containers
57-
- name: update on ubuntu
58-
command: "apt-get update"
57+
- name: Update all in Ubuntu
58+
apt:
59+
upgrade: dist
60+
update_cache: yes
61+
cache_valid_time: 86400 #One day
5962
when: ansible_distribution == 'Ubuntu'
6063
- name: Make sure we have all required packages on Ubuntu
6164
package:
@@ -95,9 +98,10 @@
9598
- /etc/cni/net.d
9699
- /etc/containers
97100
- name: install Golang upstream
98-
shell: |
99-
curl -fsSL "https://golang.org/dl/go1.8.3.linux-amd64.tar.gz" \
100-
| tar -xzC /usr/local
101+
unarchive:
102+
src: "https://golang.org/dl/go1.8.3.linux-amd64.tar.gz"
103+
dest: "/usr/local"
104+
remote_src: True
101105
- name: Set custom Golang path in RHEL/CentOS/Fedora
102106
lineinfile:
103107
dest: /root/.bashrc
@@ -108,12 +112,6 @@
108112
when: (ansible_distribution == 'Fedora' or ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS')
109113
- name: link golang
110114
file: src=/usr/local/go/bin/go dest=/usr/bin/go state=link
111-
- name: Update all in Ubuntu
112-
apt:
113-
upgrade: yes
114-
update_cache: yes
115-
cache_valid_time: 86400 #One day
116-
when: ansible_distribution == 'Ubuntu'
117115
- name: update all in RHEL/CentOS
118116
yum: name=* state=latest
119117
when: ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS'

0 commit comments

Comments
 (0)