diff --git a/inventory-localhost/hosts.yml b/inventory-localhost/hosts.yml new file mode 100644 index 0000000..d09c24c --- /dev/null +++ b/inventory-localhost/hosts.yml @@ -0,0 +1,6 @@ +# vim:ft=ansible: +all: + hosts: + localhost: + ansible_connection: local + ansible_become: no diff --git a/k8s.sh b/k8s.sh new file mode 100755 index 0000000..a5491b8 --- /dev/null +++ b/k8s.sh @@ -0,0 +1,7 @@ +#! /bin/sh + +ansible-playbook playbooks/pik8s.yml \ + -i inventory-localhost \ + -l localhost \ + --tags k8s + diff --git a/playbooks/files/k8s/desu.local/ca.crt b/playbooks/files/k8s/desu.local/ca.crt new file mode 100644 index 0000000..cf1ad88 --- /dev/null +++ b/playbooks/files/k8s/desu.local/ca.crt @@ -0,0 +1,18 @@ +-----BEGIN CERTIFICATE----- +MIIC5zCCAc+gAwIBAgIBADANBgkqhkiG9w0BAQsFADAVMRMwEQYDVQQDEwprdWJl +cm5ldGVzMB4XDTIxMDIxOTAxMTMyNVoXDTMxMDIxNzAxMTMyNVowFTETMBEGA1UE +AxMKa3ViZXJuZXRlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAN9r +fEaETyWkO49xZIyw37JNcgbwixDN+cLvnKtKqCW7u573PU0cJ+7KBuefewM6Uf+6 +Xjn/AO+vm8c1iSz41bWXcS2902SkmjWCi4H4XlxhJgSYmVJrRxL44yfrh/kNOU8T +WFtABhX2pc8HZLduvhx2CUoZSp+O3uITY3qiHaeoaoAF1eR99SCU8MAYYvRx21IO +oRK98vFAi9M2gN5/rteUXxkREdabpqDZHFgQfNUwQ7OfNMjZcOxOjY5FZc3ZYdz8 +MuboYvAtbhXfwe6dADiZHoryuMypIpMO+6sf/NFQLRr6RozT01Tn6AeSryGG1Ycl +KmKVvvnolZy4oSbVtusCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgKkMA8GA1UdEwEB +/wQFMAMBAf8wHQYDVR0OBBYEFD5eBd3k5DosRSoQG9FawHPy3hKnMA0GCSqGSIb3 +DQEBCwUAA4IBAQBWDw0Qn1EGV+ouigIQp8Te28dXA8tIO4jR5NawqTQPcLMU1QQV +/jjs5E5lpiHLECZ2vPFTSdUdmhHKbUiLwSHOn2IEI8pb43Lk8US+uiEy4K7wleu9 +SgSAVmAW7fN6w8DyYFvwqLdCiYi84CmI6BTymaYzyA3NQ2FigPjBgV4QBw8VJqG5 +bDh5Jfu/nDnxcibKt9x0BDTxS3d3OLzAnyjj5Ie9RBEYoku4Y8oHxMyWkFjeyTiT +kP07hN7Uf1Ui2+FEpcWai/WOLX3etqoT/SjLRiNWF4N4ZZPLGjpMsO+OnoqCi9Zu +vdr+IpCJrQjSuwwNiJHEphvkLtOuNOgkihky +-----END CERTIFICATE----- diff --git a/playbooks/files/k8s/desu.local/client.crt b/playbooks/files/k8s/desu.local/client.crt new file mode 120000 index 0000000..901e02f --- /dev/null +++ b/playbooks/files/k8s/desu.local/client.crt @@ -0,0 +1 @@ +/home/salt/.kube/client.crt \ No newline at end of file diff --git a/playbooks/files/k8s/desu.local/client.key b/playbooks/files/k8s/desu.local/client.key new file mode 120000 index 0000000..407493c --- /dev/null +++ b/playbooks/files/k8s/desu.local/client.key @@ -0,0 +1 @@ +/home/salt/.kube/client.key \ No newline at end of file diff --git a/playbooks/files/k8s/desu.local/kubeconfig b/playbooks/files/k8s/desu.local/kubeconfig new file mode 120000 index 0000000..3852833 --- /dev/null +++ b/playbooks/files/k8s/desu.local/kubeconfig @@ -0,0 +1 @@ +/home/salt/.kube/config \ No newline at end of file diff --git a/playbooks/pik8s.yml b/playbooks/pik8s.yml index 84c8da3..002f2b6 100755 --- a/playbooks/pik8s.yml +++ b/playbooks/pik8s.yml @@ -19,3 +19,34 @@ - name: install openshift pip: name=openshift state=latest tags: [ k8s, packages, pip ] +- hosts: localhost + gather_facts: no + vars: + k8s_path: "{{ playbook_dir }}/files/k8s/desu.local" + module_defaults: + group/k8s: + api_version: v1 + host: "https://192.168.102.1:6443" + ca_cert: "{{ k8s_path }}/ca.crt" + kubeconfig: "{{ k8s_path }}/kubeconfig" + client_cert: "{{ k8s_path }}/client.crt" + client_key: "{{ k8s_path }}/client.key" + tasks: + - name: assure nfs pv + k8s: + definition: + apiVersion: v1 + kind: PersistentVolume + metadata: + name: pv-nfs + spec: + capacity: + storage: 1.5Ti + accessModes: + - ReadWriteMany + persistentVolumeReclaimPolicy: Retain + nfs: + path: /srv/nfs/k8s + server: pi-storage-1.desu.ltd + readOnly: false + tags: [ k8s, manifest, no-pull ]