diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..8f78e08 Binary files /dev/null and b/.DS_Store differ diff --git a/.gitignore b/.gitignore index 79e55f2..49bc72c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,33 +1,7 @@ -# Local .terraform directories -**/.terraform/* -.idea +# Ignore npm installed packages +/node_modules -# .tfstate files -*.tfstate -*.tfstate.* +# Ignore coverage reports +/coverage -# Crash log files -crash.log - -# Ignore any .tfvars files that are generated automatically for each Terraform run. Most -# .tfvars files are managed as part of configuration and so should be included in -# version control. -# -# example.tfvars - -# Ignore override files as they are usually used to override resources locally and so -# are not checked in -override.tf -override.tf.json -*_override.tf -*_override.tf.json -credentials.json -*.tfbackend -*.tfvars - -# Include override files you do wish to add to version control using negated pattern -# -# !example_override.tf - -# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan -# example: *tfplan* +.idea \ No newline at end of file diff --git a/ansible/blocks.yml b/ansible/blocks.yml new file mode 100644 index 0000000..99d8209 --- /dev/null +++ b/ansible/blocks.yml @@ -0,0 +1,30 @@ +--- + +- name: Verify tests + hosts: all + gather_facts: False + tasks: + - name: Install, configure, and start Apache + block: + - name: Install httpd and memcached + ansible.builtin.yum: + name: + - httpd + - memcached + sslverify: False + state: latest + + - name: Apply the foo config template + ansible.builtin.template: + src: templates/src.j2 + dest: /etc/foo.conf + + - name: Start service bar and enable it + ansible.builtin.service: + name: bar + state: started + enabled: True + when: ansible_facts['distribution'] == 'CentOS' + become: true + become_user: root + ignore_errors: true diff --git a/ansible/fail.yaml b/ansible/fail.yaml new file mode 100644 index 0000000..58615df --- /dev/null +++ b/ansible/fail.yaml @@ -0,0 +1,29 @@ +--- +- name: Verify tests + hosts: all + gather_facts: False + tasks: + - name: Install, configure, and start Apache + block: + - name: Install httpd and memcached + ansible.builtin.yum: + name: + - httpd + - memcached + sslverify: False + state: latest + + - name: Apply the foo config template + ansible.builtin.template: + src: templates/src.j2 + dest: /etc/foo.conf + + - name: Start service bar and enable it + ansible.builtin.service: + name: bar + state: started + enabled: True + when: ansible_facts['distribution'] == 'CentOS' + become: true + become_user: root + ignore_errors: true diff --git a/ansible/k8s_utf16.yaml b/ansible/k8s_utf16.yaml new file mode 100644 index 0000000..389581a Binary files /dev/null and b/ansible/k8s_utf16.yaml differ diff --git a/ansible/nested_blocks.yml b/ansible/nested_blocks.yml new file mode 100644 index 0000000..e535f54 --- /dev/null +++ b/ansible/nested_blocks.yml @@ -0,0 +1,34 @@ +--- + +- name: Verify tests + hosts: all + gather_facts: False + tasks: + - name: 1st level block + block: + - name: 2nd level block + block: + - name: 3rd level block + block: + - name: 4th level block + block: + - name: 5th level block + block: + - name: 6th level uri + ansible.builtin.uri: + url: https://www.example.com + - name: 5th level uri + ansible.builtin.uri: + url: https://www.example.com + - name: 4th level uri + ansible.builtin.uri: + url: https://www.example.com + - name: 3rd level uri + ansible.builtin.uri: + url: https://www.example.com + - name: 2nd level uri + ansible.builtin.uri: + url: https://www.example.com + - name: 1st level uri + ansible.builtin.uri: + url: https://www.example.com diff --git a/ansible/no_tasks.yml b/ansible/no_tasks.yml new file mode 100644 index 0000000..69f9291 --- /dev/null +++ b/ansible/no_tasks.yml @@ -0,0 +1,7 @@ +--- + +- name: Sample play + hosts: + - test + roles: + - role: somerole diff --git a/ansible/site.yml b/ansible/site.yml new file mode 100644 index 0000000..95499d9 --- /dev/null +++ b/ansible/site.yml @@ -0,0 +1,21 @@ +--- + +- name: Verify tests + hosts: all + gather_facts: False + tasks: + - name: Get Running instance Info + amazon.aws.ec2_instance_info: + register: ec2info + + - name: enabled + amazon.aws.ec2_instance: + name: "public-compute-instance" + key_name: "prod-ssh-key" + vpc_subnet_id: subnet-5ca1ab1e + instance_type: c5.large + security_group: default + network: + assign_public_ip: true + image_id: ami-123456 + ebs_optimized: true diff --git a/ansible/skip.yml b/ansible/skip.yml new file mode 100644 index 0000000..48dc4a1 --- /dev/null +++ b/ansible/skip.yml @@ -0,0 +1,31 @@ +- hosts: localhost + gather_facts: false + tasks: + - name: Launch ec2 instances 1 + #checkov:skip=CKV_AWS_135 + amazon.aws.ec2_instance: + name: "bc-office-hours" + vpc_subnet_id: subnet-012d94ee641ab4277 + instance_type: t3.micro + security_group: sg-04acc4e02a5b71244 + image_id: "{{ ami_latest.image_id }}" + state: running + + - name: Launch ec2 instances 2 + amazon.aws.ec2_instance: + #checkov:skip=CKV_AWS_88 + name: "bc-office-hours" + vpc_subnet_id: subnet-012d94ee641ab4277 + instance_type: t3.micro + security_group: sg-04acc4e02a5b71244 + image_id: "{{ ami_latest.image_id }}" + state: running + + - name: http + #checkov:skip=CKV2_ANSIBLE_1 + uri: + url: http://www.example.com + return_content: yes + register: this + failed_when: "'AWESOME' not in this.content" + diff --git a/ansible/tasks.yml b/ansible/tasks.yml new file mode 100644 index 0000000..398a080 --- /dev/null +++ b/ansible/tasks.yml @@ -0,0 +1,12 @@ +--- + +- name: Check that you can connect (GET) to a page + uri: + url: https://www.example.com + +- name: Download foo.conf + ansible.builtin.get_url: + url: https://example.com/path/file.conf + dest: /etc/foo.conf + mode: '0440' + validate_certs: false diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index 630d9ae..0000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM base - -LABEL foo="bar baz" -ADD http://example.com/package.zip /temp -USER me - diff --git a/docker/dockerfile b/docker/dockerfile new file mode 100644 index 0000000..41e6a4d --- /dev/null +++ b/docker/dockerfile @@ -0,0 +1,15 @@ +FROM node:12-alpine +ENV NODE_ENV "production" +ENV PORT 8079 +EXPOSE 8079 +RUN addgroup mygroup && adduser -D -G mygroup myuser && mkdir -p /usr/src/app && chown -R myuser /usr/src/app +# Prepare app directory +WORKDIR /usr/src/app +COPY package.json /usr/src/app/ +COPY yarn.lock /usr/src/app/ +RUN chown myuser /usr/src/app/yarn.lock +USER myuser +RUN yarn install +COPY . /usr/src/app +# Start the app +CMD ["/usr/local/bin/npm", "start"] \ No newline at end of file