Skip to content

Commit 2738086

Browse files
committed
chore:added go path and permissions
1 parent 4d5bbcd commit 2738086

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

test/deploy/linux/go/redhat/roles/configure/tasks/main.yml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,41 @@
22
- debug:
33
msg: Install go
44

5-
- name: install go
5+
- name: Install go
66
shell: yum install go -y
77
become: true
88

99
- name: Create templates directory
1010
file:
11-
path: ~/templates
11+
path: /home/ec2-user/templates
1212
state: directory
1313

1414
- name: Copy files to templates directory
1515
synchronize:
1616
src: "{{ item }}"
17-
dest: ~/templates/
17+
dest: /home/ec2-user/templates
1818
mode: push
1919
with_fileglob:
2020
- "../../../../templates/*"
2121
become: true
2222

23-
- name: Run go mod init
24-
shell: cd /home/ec2-user/templates && go mod init home/ec2-user/templates
23+
- name: Initialize and tidy Go modules
24+
shell: |
25+
cd /home/ec2-user/templates &&
26+
export GOPATH=/home/ec2-user/go &&
27+
export GOBIN=/home/ec2-user/go/bin &&
28+
go mod init home/ec2-user/templates &&
29+
go mod tidy
2530
become: true
26-
27-
- name: Run go mod tidy
28-
shell: cd /home/ec2-user/templates && go mod tidy
29-
become: true
30-
31-
- name: Change Permissions for /home/ec2-user/templates
32-
shell: chown -R ec2-user:ec2-user /home/ec2-user/templates/ && chmod -R 755 /home/ec2-user/templates
31+
environment:
32+
PATH: "{{ ansible_env.PATH }}"
33+
34+
- name: Change Permissions for /home/ec2-user/templates && go
35+
shell: |
36+
chown -R ec2-user:ec2-user /home/ec2-user/templates/ &&
37+
chmod -R 755 /home/ec2-user/templates &&
38+
chown -R ec2-user:ec2-user /home/ec2-user/go/ &&
39+
chmod -R 755 /home/ec2-user/go
3340
become: true
3441

3542
# Use the below command to run it locally

test/manual/definitions/apm/go/go-linux2.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
{
2020
"id": "go",
2121
"source_repository": "https://github.com/newrelic/open-install-library.git",
22-
"deploy_script_path": "test/deploy/linux/go/redhat/roles",
22+
"deploy_script_path": "test/deploy/linux/go/redhat/roles",
2323
"port": 80,
2424
"destinations": ["go-l2"]
2525
}
2626
]
27-
}
27+
}

0 commit comments

Comments
 (0)