Skip to content

Commit 24d93d2

Browse files
Script is no completely idepotent
1 parent a0ff8b0 commit 24d93d2

File tree

3 files changed

+26
-11
lines changed

3 files changed

+26
-11
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Vagrantfile and resources to make a development instance of AEM in Virtualbox
2424

2525
2. `vagrant up` from project root (might take a while)
2626

27-
3. Navigate to `192.168.99.43:4502` to access AEM
27+
3. Navigate to `localhost:4502` to access AEM
2828

2929
*You can now safely remove the `jar` and `license.properties` placed from step 2*
3030

Vagrantfile

+2-4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ Vagrant.configure(2) do |config|
2727
config.vm.network "private_network", ip: "192.168.99.43"
2828

2929
# Ports for AdobeEM
30-
# Uncomment below if you want to access via localhost:xxxx
31-
# where xxxx is the port listed below.
32-
#config.vm.network "forwarded_port", guest: 4502, host: 4502
33-
#config.vm.network "forwarded_port", guest: 45335, host: 45335
30+
config.vm.network "forwarded_port", guest: 4502, host: 4502
31+
config.vm.network "forwarded_port", guest: 45335, host: 45335
3432

3533
# Required to use ansible with dnf installer
3634
config.vm.provision "shell", inline: "dnf install python-dnf -y"

playbook.yml

+23-6
Original file line numberDiff line numberDiff line change
@@ -67,33 +67,50 @@
6767
retries: 60
6868
become: false
6969

70-
- name: Install and Activate AEM Service Pack 1 package (automatically restarts the server)
71-
command: curl -u admin:admin -F file=@"/home/vagrant/aem_install_files/packages_to_install/servicepacks/aem-service-pkg-wrapper-6.1.SP1.zip" -F force=true -F install=true localhost:4502/crx/packmgr/service.jsp
72-
become: false
70+
- name: Check if AEM Service Pack 1 has been installed
71+
command: curl --fail -u admin:admin http://localhost:4502/crx/packmgr/service.jsp?cmd=ls
72+
register: installedBundlesPreSP1Check
73+
74+
- name: Install and Activate AEM Service Pack 1 package (automatically restarts the server) if not installed
75+
command: curl --fail -u admin:admin -F file=@"/home/vagrant/aem_install_files/packages_to_install/servicepacks/aem-service-pkg-wrapper-6.1.SP1.zip" -F force=true -F install=true localhost:4502/crx/packmgr/service.jsp
76+
when: installedBundlesPreSP1Check.stdout.find("aem-service-pkg-wrapper-6.1.SP1.zip") == -1
7377

7478
- name: Wait for the server to come up
7579
shell: 'curl 127.0.0.1:4502 -L -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:46.0) Gecko/20100101 Firefox/46.0"'
7680
register: afterServicePackInstall
7781
until: afterServicePackInstall.stdout.find("Sign In") != -1
7882
retries: 60
7983
become: false
84+
85+
- name: Check if ACS-Commons Library has been installed
86+
command: curl --fail -u admin:admin http://localhost:4502/crx/packmgr/service.jsp?cmd=ls
87+
register: installedBundlesPreACSCommonsCheck
8088

81-
- name: Install ACS-Commons Library (automatically restarts the server)
82-
shell: curl --fail -u admin:admin -F file=@"/home/vagrant/aem_install_files/packages_to_install/servicepacks/acs-aem-commons-content-2.4.2-min.zip" -F force=true -F install=true localhost:4502/crx/packmgr/service.jsp
89+
- name: Install ACS-Commons Library (automatically restarts the server) if not installed
90+
command: curl --fail -u admin:admin -F file=@"/home/vagrant/aem_install_files/packages_to_install/servicepacks/acs-aem-commons-content-2.4.2-min.zip" -F force=true -F install=true localhost:4502/crx/packmgr/service.jsp
91+
when: installedBundlesPreACSCommonsCheck.stdout.find("acs-aem-commons-content-2.4.2.zip") == -1
8392

8493
- name: Wait for the server to come up
8594
shell: 'curl 127.0.0.1:4502 -L -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:46.0) Gecko/20100101 Firefox/46.0"'
8695
register: afterACSCommonsInstall
8796
until: afterACSCommonsInstall.stdout.find("Sign In") != -1
8897
retries: 60
8998
become: false
99+
100+
- name: Check if UI-apps has been installed
101+
command: curl --fail -u admin:admin http://localhost:4502/crx/packmgr/service.jsp?cmd=ls
102+
register: installedBundlesPreUIAppsCheck
103+
104+
- name: Install ui-apps (components) if not installed
105+
shell: curl --fail -u admin:admin -F file=@"/home/vagrant/aem_install_files/packages_to_install/servicepacks/gc-aem.ui.apps-1.12.1.zip" -F force=true -F install=true localhost:4502/crx/packmgr/service.jsp
106+
when: installedBundlesPreUIAppsCheck.stdout.find("gc-aem.ui.apps-1.12.1.zip") == -1
90107

91108
- name: Get list of content packs to install
92109
shell: ls /home/vagrant/aem_install_files/packages_to_install/content/*
93110
register: packages_list
94111

95112
- name: Install all content packs
96-
shell: 'curl --fail -u admin:admin -F file=@"{{item}}" -F force=true -F install=true localhost:4502/crx/packmgr/service.jsp && sleep 2'
113+
shell: 'if [[ $(curl --fail -u admin:admin http://localhost:4502/crx/packmgr/service.jsp?cmd=ls) != *$(basename "{{item}}")* ]]; then curl --fail -u admin:admin -F file=@"{{item}}" -F force=true -F install=true localhost:4502/crx/packmgr/service.jsp && sleep 2; fi'
97114
with_items: packages_list.stdout_lines
98115
become: false
99116

0 commit comments

Comments
 (0)