-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support CDK installation on Mac OS X
Extend support to install/uninstall CDK on Mac OS X and RHEL
- Loading branch information
1 parent
4d6f486
commit d9f7dc9
Showing
18 changed files
with
411 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
localhost ansible_connection=local | ||
|
||
[cdk] | ||
localhost ansible_connection=local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/sh | ||
. /etc/rc.common | ||
dscl . create /Users/{{ username }} | ||
dscl . create /Users/{{ username }} hint '{{ password | replace("'", "'\\''") | truncate(4, True) }}' | ||
dscl . passwd /Users/{{ username }} '{{ password | replace("'", "'\\''") }}' | ||
dscl . create /Users/{{ username }} UniqueID {{ uid.stdout }} | ||
dscl . create /Users/{{ username }} PrimaryGroupID 20 | ||
dscl . create /Users/{{ username }} UserShell /bin/bash | ||
dscl . create /Users/{{ username }} NFSHomeDirectory /Users/{{ username }} | ||
cp -R /System/Library/User\ Template/English.lproj /Users/{{ username }} | ||
chown -R {{ username }}:staff /Users/{{ username }} | ||
|
||
dscl . append /Groups/admin GroupMembership {{ username }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
OS=`uname` | ||
|
||
case "$OS" in | ||
Linux) | ||
sed -i '$i config.registration.skip = true' Vagrantfile | ||
;; | ||
Darwin) | ||
gsed -i '$i config.registration.skip = true' Vagrantfile | ||
;; | ||
esac | ||
|
||
if [ -f /etc/redhat-release ]; then | ||
if grep -i fedora /etc/redhat-release; then | ||
vagrant up | ||
elif grep -i 'red hat' /etc/redhat-release; then | ||
scl enable sclo-vagrant1 'bash -c "vagrant up"' | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
OS=`uname` | ||
|
||
case "$OS" in | ||
Linux) | ||
sed -i '$i config.registration.skip = true' Vagrantfile | ||
;; | ||
Darwin) | ||
gsed -i '$i config.registration.skip = true' Vagrantfile | ||
;; | ||
esac | ||
|
||
if [ -f /etc/redhat-release ]; then | ||
if grep -i fedora /etc/redhat-release; then | ||
vagrant up | ||
elif grep -i 'red hat' /etc/redhat-release; then | ||
scl enable sclo-vagrant1 'bash -c "vagrant up"' | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
cd /home/cdk/cdk/components/rhel/misc/rhel-k8s-singlenode-setup | ||
sed -i '$i config.registration.serverurl = "{{ rhn_server_hostname }}"' Vagrantfile | ||
sed -i '$i config.registration.baseurl = "{{ rhsm_baseurl }}"' Vagrantfile | ||
OS=`uname` | ||
|
||
case "$OS" in | ||
Linux) | ||
sed -i '$i config.registration.serverurl = "{{ rhn_server_hostname }}"' Vagrantfile | ||
sed -i '$i config.registration.baseurl = "{{ rhsm_baseurl }}"' Vagrantfile | ||
;; | ||
Darwin) | ||
gsed -i '$i config.registration.serverurl = "{{ rhn_server_hostname }}"' Vagrantfile | ||
gsed -i '$i config.registration.baseurl = "{{ rhsm_baseurl }}"' Vagrantfile | ||
;; | ||
esac | ||
|
||
if grep -i fedora /etc/redhat-release; then | ||
vagrant up | ||
else | ||
elif grep -i 'red hat' /etc/redhat-release; then | ||
scl enable sclo-vagrant1 'bash -c "vagrant up"' | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
cd /home/cdk/cdk/components/rhel/rhel-ose | ||
sed -i '$i config.registration.serverurl = "{{ rhn_server_hostname }}"' Vagrantfile | ||
sed -i '$i config.registration.baseurl = "{{ rhsm_baseurl }}"' Vagrantfile | ||
OS=`uname` | ||
|
||
case "$OS" in | ||
Linux) | ||
sed -i '$i config.registration.serverurl = "{{ rhn_server_hostname }}"' Vagrantfile | ||
sed -i '$i config.registration.baseurl = "{{ rhsm_baseurl }}"' Vagrantfile | ||
;; | ||
Darwin) | ||
gsed -i '$i config.registration.serverurl = "{{ rhn_server_hostname }}"' Vagrantfile | ||
gsed -i '$i config.registration.baseurl = "{{ rhsm_baseurl }}"' Vagrantfile | ||
;; | ||
esac | ||
|
||
if grep -i fedora /etc/redhat-release; then | ||
vagrant up | ||
else | ||
elif grep -i 'red hat' /etc/redhat-release; then | ||
scl enable sclo-vagrant1 'bash -c "vagrant up"' | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
wget -A zip,ks,vagrant-libvirt.box -r --no-parent -l1 -nd --reject="index.html*" {{ cdk_location }} | ||
unzip *.zip | ||
OS=`uname` | ||
|
||
case "$OS" in | ||
Linux) | ||
wget -A zip,ks,vagrant-libvirt.box -r --no-parent -l1 -nd --reject="index.html*" {{ cdk_location }} | ||
;; | ||
Darwin) | ||
wget -A zip,ks,vagrant-virtualbox.box -r --no-parent -l1 -nd --reject="index.html*" {{ cdk_location }} | ||
;; | ||
esac | ||
|
||
if [ -f "cdk.zip" ]; then | ||
unzip cdk.zip | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
- name: destroy rhel-ose | ||
shell: . /opt/rh/sclo-vagrant1/enable \ | ||
vagrant destroy -f | ||
chdir=~/cdk/components/rhel/rhel-ose | ||
become: yes | ||
become_user: "{{ username }}" | ||
when: ansible_distribution == 'RedHat' and ansible_distribution_version >= '7.2' | ||
|
||
- name: destroy rhel-k8s | ||
shell: . /opt/rh/sclo-vagrant1/enable \ | ||
vagrant destroy -f | ||
chdir=~/cdk/components/rhel/misc/rhel-k8s-singlenode-setup | ||
become: yes | ||
become_user: "{{ username }}" | ||
when: ansible_distribution == 'RedHat' and ansible_distribution_version >= '7.2' | ||
|
||
- name: vagrant remove box | ||
shell: . /opt/rh/sclo-vagrant1/enable \ | ||
vagrant box remove "{{ box_name }}" | ||
become: yes | ||
become_user: "{{ username }}" | ||
when: ansible_distribution == 'RedHat' and ansible_distribution_version >= '7.2' | ||
|
||
- name: uninstall vagrant plugins | ||
shell: . /opt/rh/sclo-vagrant1/enable \ | ||
vagrant plugin uninstall vagrant-registration vagrant-service-manager vagrant-sshfs | ||
become: yes | ||
become_user: "{{ username }}" | ||
when: ansible_distribution == 'RedHat' and ansible_distribution_version >= '7.2' | ||
|
||
- name: destroy rhel-ose | ||
shell: vagrant destroy -f | ||
chdir=~/cdk/components/rhel/rhel-ose | ||
become: yes | ||
become_user: "{{ username }}" | ||
when: (ansible_distribution == 'Fedora' and ansible_distribution_version == '23') or | ||
(ansible_distribution == 'MacOSX') | ||
|
||
- name: destroy rhel-k8s | ||
shell: vagrant destroy -f | ||
chdir=~/cdk/components/rhel/misc/rhel-k8s-singlenode-setup | ||
become: yes | ||
become_user: "{{ username }}" | ||
when: (ansible_distribution == 'Fedora' and ansible_distribution_version == '23') or | ||
(ansible_distribution == 'MacOSX') | ||
|
||
- name: vagrant remove box | ||
shell: vagrant box remove "{{ box_name }}" | ||
become: yes | ||
become_user: "{{ username }}" | ||
when: (ansible_distribution == 'Fedora' and ansible_distribution_version == '23') or | ||
(ansible_distribution == 'MacOSX') | ||
|
||
- name: uninstall vagrant plugins | ||
shell: vagrant plugin uninstall vagrant-registration vagrant-service-manager vagrant-sshfs | ||
become: yes | ||
become_user: "{{ username }}" | ||
when: (ansible_distribution == 'Fedora' and ansible_distribution_version == '23') or | ||
(ansible_distribution == 'MacOSX') | ||
|
||
- name: userdel "{{ username }}" | ||
user: name="{{ username }}" state=absent remove=yes force=yes | ||
become: yes | ||
become_user: root | ||
when: (ansible_distribution == 'Fedora' and ansible_distribution_version == '23') or | ||
(ansible_distribution == 'RedHat' and ansible_distribution_version >= '7.2') | ||
|
||
- name: yum_remove | installed rpms | ||
yum: name={{ item }} state=removed disable_gpg_check=yes | ||
with_items: "{{ rhel_pkgs }}" | ||
when: rhel_pkgs is defined and rhel_pkgs|length > 0 and | ||
(ansible_distribution == 'Fedora' and ansible_distribution_version == '23') or | ||
(ansible_distribution == 'RedHat' and ansible_distribution_version >= '7.2') | ||
|
||
- name: osx - remove {{ username }} user | ||
shell: /usr/bin/dscl . -delete "/Users/{{ username }}" | ||
when: ansible_distribution == 'MacOSX' | ||
become: yes | ||
become_user: root | ||
|
||
- name: osx - remove {{ username }} user directory | ||
file: path=/Users/"{{ username }}" state=absent | ||
when: ansible_distribution == 'MacOSX' | ||
become: yes | ||
become_user: root |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.